- Getting Started
- Code Style
- Tests
- Deploying to Heroku
- Heroku Specific Links
- Documentation
- Universal Javascript Known Issues
- Git Cheatsheet
- Create
.env
file and set todevelopment
values (see example.env
file) - Edit
/etc/hosts
, add127.0.0.1 www.domain.dev
and127.0.0.1 api.domain.dev
- Run
npm install
- Run
npm run watch
NODE_ENV=development
PORT=3000
URL=http://www.domain.dev:3000
API_URL=http://api.domain.dev:3000
API_VHOST=api.domain.*
MONGODB_URL=127.0.0.1:27017/db
- When running in
development
, SSR is turned off by default - When running in
production
, SSR is turned on by default
- Running
npm run build
will create the/assets
folder - To simulate a
production
build, runNODE_ENV=production npm run build
- To simulate a
production
server, runNODE_ENV=production npm start
-
Javascript: https://github.com/airbnb/javascript/blob/master/README.md
-
React: https://github.com/airbnb/javascript/blob/master/react/README.md
-
There are some exceptions (making certain errors into warnings)
-
See
package.json
->eslintConfig.rules
- Presets used:
es2015
,react
,stage-1
- Plugins used:
transform-runtime
- See
package.json
->babel
-
Extends from
airbnb
rules -
See
package.json
->eslintConfig
-
Run
npm run eslint
to lint all code -
Run
npm run eslint:api
to lint only api code -
Run
npm run eslint:www
to lint only app code
- Extends from
stylelint-config-standard
rules - See
package.json
->stylelint
- Uses
mocha
,chai
,sinon
- Make sure
Heroku App Config Variables
are set toproduction
values - No need to set
PORT
- No need to set
NODE_ENV
, Heroku defaults toproduction
- Use
--max_old_space_size=460
for 1x dynos - Use
--max_old_space_size=920
for 2x dynos - See
package.json
->scripts.start
- Run
npm run rollback
to rollback to the previous Heroku deploy
- Run
npm run purge
to wipe the Herokunode_modules
cache
- https://devcenter.heroku.com/articles/node-best-practices#avoid-garbage
- https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps
./server.js
- the primary express server which utilizes 2vhosts
, one for theapp
and one for theapi
/bin/bootstrap.js
- launches the app, depends onNODE_ENV
/bin/build.js
- uses webpack to build production assets/bin/webpack-dev-server.js
- indevelopment
, launches the webpack livereload proxy
/webpack/webpack.config.js
- webpack config depends onNODE_ENV
/webpack/loaders.js
- shared webpack loaders for all environments/webpack/plugins.js
- shared webpack plugins for all environments/webpack/build-define.js
- generates environment variables to be passed to the app/webpack/build-css-loaders.js
- generates css/scss/less and css modules loaders (postcss)
- This is where the client-side React app lives
- This is where the backend api lives
- Can't use https://github.com/tcoopman/image-webpack-loader because of
images-require-hook
git fetch
git reset --hard origin/master