Starter project for NodeJS Express apps built with Typescript
- Rate limiting
- Caching API response via redis
- Unit tests with jest
- Production ready docker file for mongo, redis, and running multiple instances of the app via pm2
- typescript integration
- Clustering
- Graceful start & Shutdown
- Gzip compression
- Securing HTTP headers using helmet & DDos preventing with rate limit
- .env files for setting up environment variables1
- Advanced logging with bunyan
- git commit hooks to automatically fix lint errors with StandardJS
use yarn dev to run the app in dev mode and restart the app on file changes thanks to nodemon
use yarn test or yarn test:watch to run the unit tests configured with jest. supertest library is also setup for testing http requests / APIs
yarn test will also print out code coverage information
use yarn lint to print out lint errors or yarn lint:fix to fix lint errors.. It is recommended to add yarn lint as a git commit prehook to see lint errors before commiting
use yarn start to run the application or yarn cluster to run multiple instances of the application depending on the CPU support as implemented in clusters.ts file
To run the app standalone without docker make sure you have redis-server and mongod install then run
mongodredis-servernodemon --inspect src/index.tsorts-node src/index.ts
To run the app via docker run
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up