Slightly more opinionated and less agnostic version of Vassilis Mastorostergios' Express.js with Babel Boilerplate.
- Express.js as the web framework
- ES2017+ support with Babel
- Automatic polyfill requires based on environment with babel-preset-env
- Linting with ESLint
- Testing with Jest
- Node clustering concurrency (https://devcenter.heroku.com/articles/node-concurrency)
- Updated engines and all dependencies (current as of July 1, 2018)
- Logging with Winston (custom format, rotating logs to disk)
- Security with Helmet
- NPM dev script clean builds before restarting (so changes take effect)
- Optional environment variables for server port, minimum log level, max log size and web concurrency
- Yarn instead of NPM
- Configured for deployment to Heroku
- Heroku node garbage collection strategy (https://devcenter.heroku.com/articles/node-best-practices), applied to package.json "start" script (instead of the Procfile) for consistency
# Clone the project
git clone git@github.com:daniel-lanciana/heroku-express-babel.git
cd heroku-express-babel
# Make it your own
rm -rf .git && git init && npm init
# Install dependencies
yarn
# Build and start local server (server will restart when code changes)
yarn run dev
# Run tests (Jest runner and basic assertions, supertest API testing)
yarn test
# Run tests with coverage
yarn test --coverage
# Static code analysis (i.e. linting) using ESLint
yarn run lint
Rename .env.example
to .env
and add your environment variables. Powered by dotenv.
Add Heroku environment variables via the web console.
Either through the command line or create a Heroku app and connect to GitHub and deploy from the web console.
MIT License. See the LICENSE file.