- NodeJS
- Node Package Management (
yarn
ornpm
) - Docker
- Clone the project
git clone git@github.com:vukhanhtruong/nodejs-api-boilerplate.git
. - Install dependencies
yarn install
ornpm i
- Copy
.env.example
to.env
file.
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:deploy
Using husky
for linting your code before commit & running unit test before push.
yarn dev
# or
npm run dev
Debug with VSCode. See VSCode Auto-Attach
yarn debug
# or
npm run debug
yarn test
# or
npm run test
NOTE: 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 -p
yarn 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:deploy
Generate heroku token. Then add this token to Gitlab CI Variables as HEROKU_TOKEN
heroku auth:token
Code 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