Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and Sequelize
- No transpilers, just vanilla javascript
- ES2017 latest features like Async/Await
- CORS enabled
- Uses yarn
- Express + Postgres (Sequelize)
- Request validation (express validator
- Consistent coding styles with editorconfig
- Uses helmet to set some HTTP headers for security
- Load environment variables from .env files with dotenv
- Gzip compression with compression
- Linting with eslint
- Tests with mocha, chai and sinon
- Code coverage with istanbul and coveralls
- Git hooks with husky
- Logging with morgan
- Authentication and Authorization with passport
- API documentation generation with apidoc
- Continuous integration support with travisCI
- Monitoring with pm2
Clone the repo and make it yours:
git clone --depth 1 https://github.com/DenisRupp/express-starter
cd express-starter
rm -rf .git
Install dependencies:
yarn
Set environment variables:
cp .env.example .env
Set database configuration:
cp src/database/config.example.js src/database/config.js
Crete database
sequelize db:create --env development
yarn local
yarn start
# run all migrations
yarn migrate
# run all seeds
yarn seeds
# generate new migration
sequelize migration:generate --name new-migration
# generate new seed
sequelize seed:generate --name new-seeds
More commands here.
# lint code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# lint and watch for changes
yarn lint:watch
# run all tests with Mocha
yarn test
# run unit tests
yarn test:unit
# run integration tests
yarn test:integration
# run all tests and watch for changes
yarn test:watch
# open nyc test coverage reports
yarn coverage
# show logs in production
pm2 logs
# deploy to dev
pm2 deploy dev
# generate and open api documentation
yarn docs
Inspired by danielfsousa