React Stripe base
Commands
- Run the app.
yarn start
ornpm start
- Build the app.
yarn build
ornpm run build
- Lint the app.
yarn lint
ornpm run lint
- Test the app.
yarn test
ornpm run test
, for UI optionyarn test:open
ornpm run test:open
, - Run the app with SSR.
yarn ssr
ornpm run ssr
Getting Started
- Clone the repository
- Install dependencies:
yarn
ornpm install
- Create the environment variables files in root folder(.env.dev, .env.staging and .env.prod):
.env.example
example:
API_URL=http://your-api-url.com
AWS_BUCKET=bucket
AWS_REGION=region
AWS_ACCESS_KEY_ID=key_id
AWS_SECRET_ACCESS_KEY=secret_key
- Start the dev server:
yarn start
ornpm start -s
Running script with different environments
To change the set of environment variables for a script it's needed to run ENV=my_environment before the script.
For example: ENV=staging yarn build
Configuring Code Climate
- After adding the project to CC, go to
Repo Settings
- On the
Test Coverage
tab, copy theTest Reporter ID
- Replace the current value of
CC_TEST_REPORTER_ID
on theconfig.yml file (.circleci/config.yml)
with the one you copied from CC
Initial Machine Setup
Install Node 7.0.0 or greater, 10.14.2 LTS preferred
Project is currently set to node version 10.14.2 LTS
. Make sure that you are using the node version specified in the package.json
, if you prefer to use a different one you can change it there.
Install Yarn - Fast, reliable, and secure package manager
Redux setup
The base makes use of our redux-tools package. This makes working with, and tracking the status of async side effect easier. Learn more about this in the redux-tools readme.
Server Side Rendering
This base is already set up with a Node server for SSR.
The command yarn ssr
will compile the server and client.
Fetching data
The server is prepared to fetch data directly from the backend before rendering the HTML.
Deploying to AWS S3
- Add the environment variables for each .env AWS_BUCKET, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
- Run the command to deploy with an environment
ENV=your_environment yarn deploy
Deploying to Heroku
- Add all the environment variables in .env to Heroku
- Add the env variable NPM_CONFIG_PRODUCTION=false to Heroku
- Deploy your branch to Heroku