Starter project with Typeorm and centralized environment configuration. It's also comes with Dockerfile and docker-compoe file. This features Typeorm auto migration at runtime in docker container before the nest js start. Forked from Nest framework TypeScript starter repository
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Create ormconfig.json first in the root folder to set up your database. For reference read the ormconfig.json configuration.
$ npm run migration:generate "AddSomeTable"
This will create a migration file named {timestamp}-AddSomeTable.ts
on /migration
folder under the database
module
# this will run migration file
$ npm run db:migrate
# this will revert migration file
$ npm run db:revert
# build docker images
$ docker build . -t nest-starter-project
# or run docker-compose
$ docker-compose up --build
Auto migration using typeorm migrationsRun at startup
Environment configuration done by loading all declared environtment in config
module. If you want to add more configuration, add it to config.service.ts
in config
module
This starter project also comes with interceptor. These are:
- Entity not found interceptor
This interceptor will return 404 status code if the error type isEntityNotFoundError
- Plain to class interceptor
This interceptor will transform returned data match to the DTO, so we dont have to transform it manually - Response transform interceptor
This interceptor will transform the response object so you can make a custom structur of the response object
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Nest is MIT licensed.