- NodeJS
- Node Package Management (
yarnornpm) - Docker
- Clone the project
git clone git@github.com:vukhanhtruong/nodejs-api-boilerplate.git. - Install dependencies
yarn installornpm i - Copy
.env.exampleto.envfile.
docker-compose up -d.
Create account at Sentry, then put your url to .env file at variable SENTRY_DSN.
Api doc his hosted on surge. For change the url and have your own docs just modify your link in the .env file. Running the following command to publish your documentation.
# Generate document
yarn doc
# Deploy document to surge.sh
yarn doc:deploy
# or
npm run doc
npm run doc:deployUsing husky for linting your code before commit & running unit test before push.
yarn dev
# or
npm run devDebug with VSCode. See VSCode Auto-Attach
yarn debug
# or
npm run debugyarn test
# or
npm run testNOTE: If you have the issue with ENOSPC, run the below command to avoid:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -pyarn test:watch# run jest coverage
yarn test:cover
# show html report
yarn test:cover:open
# or
npm run test:cover
npm run test:cover:open# generate documentation
yarn doc
# Publish documentation to surge.sh
yarn doc:deploy
#or
npm run doc
npm run doc:deployGenerate heroku token. Then add this token to Gitlab CI Variables as HEROKU_TOKEN
heroku auth:tokenCode will automatically test & deploy to Heroku after merging into development branch.
To test gitlabCI on locally, run the following command
# to run test service
gitlab-runner exec docker test
# to run deployment service
gitlab-runner exec docker development --docker-privileged- Backpack
- Express Brute
- Helmet
- Cors
- Body-Parser
- Morgan
- PassportJS
- Passport-Local
- Passport-JWT
- Raven
- Joi
- Http-Status
- Lint-Staged
- Husky
- Prettier
- Eslint Config Prettier
- Jest
- Chai
- Supertest
- NPS
- MongoDB
- Mongoose