Backend API build with Nest Framework.
Component | Using | Descrption |
---|---|---|
Base | NestJS | |
ORM | TypeORM | |
File Upload | Multer | |
Validation | Class-Validator | |
Documentation | Open API(Swagger) | |
Authentication | Passport.js | |
Testing | Jest & SuperTest | |
Code Style | Prettier & TS-Lint |
start Postgres
# start local postgres
docker-compose up postgres
docker-compose up -V postgres #remove volumes
# stop local postgres before restart again
docker-compose down
docker-compose down -v #remove volumes
if error
The container name "/postgres" is already in use by container
, remove orphan container.
docker ps -a
docker rm 82be5234c94a
# start in watch mode
ng serve api
# to turn on logging for `request`
NODE_DEBUG=request ng serve api
DEBUG=typeorm:* ng serve api
# optinally you can run with prod env(environment.prod.ts) for tesrting! use this for testing only.
ng serve api --prod
# build first
ng build api --prod
# then run
npm run api:start:prod
API URL: http://localhost:3000
Swagger Docs URL: http://localhost:3000/docs
build for production env
npm run api:build
scaffolding nest artifacts
For more details checkout playbook
# check of nest installed
nest info
# scaffold auth module
nest g module app/auth --dry-run
nest g controller auth app/auth --flat --dry-run
nest g service auth app/auth --flat --dry-run
nest g class user.entity app/auth --no-spec --dry-run
nest g class auth.exception app/auth --no-spec --dry-run
coverage will be generate in coverage/apps/api
# unit tests
ng test api
# e2e tests
ng test api-e2e
- Awesome Nest
- NestJS Samples
- TypeORL Samples