This is the repository that holds the web client for Mee Panyar.
- For the associated backend repository, go to: https://github.com/calblueprint/meepanyar-node
- Documentation hub: https://github.com/calblueprint/meepanyar/wiki
-
Clone Repository a. Click on the green
Code
button and copy the https URL in the dropdown b. In your terminal, cd to the desired directory and dogit clone {COPIED URL}
-
Setting Up Environment Variables For security reasons, this project uses secrets that are passed via environment variables held in a
.env
file. You will create and set up your.env
file in the following steps. a. In the top level directory (where.env.example
is located), create a copy of.env.example
and rename the copied file.env
. b. Fill out the environment variables with their appropriate values in the.env
file. TheREACT_APP_AIRTABLE_ENDPOINT_URL
should point to the URL where themeepanyar-node
server is located. c. You may locate yourREACT_APP_AIRTABLE_BASE_ID
by going to https://airtable.com/api and clicking on the appropiate Airtable base to use.For example, if your launched
meepanyar-node
server is onlocalhost:4000
, which is the default, your.env
file could look like the following:AIRTABLE_EMAIL=my_airtable_email@berkeley.edu AIRTABLE_PASSWORD=my_airtable_password REACT_APP_AIRTABLE_BASE_ID=my_airtable_base_id REACT_APP_AIRTABLE_ENDPOINT_URL=http://localhost:4000
-
Running the development environment
- Since the web client relies on the
meepanyar-node
backend server, make sure that an instance ofmeepanyar-node
is running and that the environment variableREACT_APP_AIRTABLE_ENDPOINT_URL
in the.env
file points to it. Local setup instructions for themeepanyar-node
server can be found at the repo here - run
npm install
to install the dependencies necessary to run the app. - Start the web client by running
npm start
in the terminal while in the root directory (where thepackage.json
file is located)
- Since the web client relies on the
-
Running the production environment (Not usually necessary for standard develop)
A production build must be used to test offline functionality of the app. This is because service workers, which control the app logic when offline, are only active in the production build. This section will list how to create and run a production build of the app locally.
- As with the development environment, a working
meepanyar-node
backend must be running. Do step 3i (Running the development environment) - run
npm install
to install the dependencies necessary to run the app. - In the root directory, run
npm run build
to create the production build for the app. This command creates abuild/
folder that contains the production build for the app. - Run the production build by running
serve -s build
in the root directory
Note: if you get an error when running 4iv, you may need to install
serve
vianpm install -g serve
. - As with the development environment, a working
This app uses the Airtable Schema Generator to generate boilerplate Airtable CRUD functions. When the Airtable base's schema is changed (tables or columns are added or deleted), the schema must be regenerated. You can regenerate the airtable by following the steps:
- In your
.env
file make sure theAIRTABLE_EMAIL
,AIRTABLE_PASSWORD
, andREACT_APP_AIRTABLE_BASE_ID
are populated. - Run
npm run generate-schema
in the root directory. - Apply the patches located in
src/lib/airtable/patches
. Instructions to apply patches are located in a README.md file in the patches directorysrc/lib/airtable/patches/README.md
. NOTE: These patches are needed to fix grammar mistakes in CRUD naming convention and adjust functions for offline functionality in the app