Backend template written in TypeScript with NestJS
$ npm install
# To use NestJS CLI install it globally
$ npm i -g @nestjs/cli
Docker is highly recommended for development. Please make sure that Docker Engine is installed in your PC. There is basically configured multi-stage Dockerfile which can be used for deployment and development purposes in this repository.
# development
$ docker compose up
# if there is an existing docker image built before and fresh build needed
$ docker compose up --build
# for detached terminal
$ docker compose up -d
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Visit the NestJS Documentation to learn more about the framework.
- A comprehensive local development guide using Docker with this project.
- To create optimized Dockerfile for production check this guide.
- Redis usage with NestJS
.env files has been choosen by the current NODE_ENV
situation. If NODE_ENV=development
the choosen env file would be ./config/env/development.env
After changing the .env files they should be validated in ./config/validation.ts
file for better development experience. Also they can be added into ./config/FILE_NAME.config.ts
file to use them easily. This documentation would be helpful for those who are new in NestJS.