Skip to content

NestJS Boilerplate. JWT, Swagger, TypeORM, Test e2e & unit, friendly errors, pagination

Notifications You must be signed in to change notification settings

AntonyZ89/nestjs-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

Description

Nest framework TypeScript starter repository.

Built with

  • TypeScript
  • NestJS
    • JWT
    • Swagger
    • Class validator
    • Custom validators for database constraints
    • TypeORM
  • ESLint
  • Jest
  • Husky
  • EditorConfig

Prints 📷

Swagger

URL: /api

Swagger API
Friendly errors on response
  • Custom validators
    • Unique constraint
    • Exist constraint
Unique validator Exist validator
  • All errors are returned inside "errors" key on response.
  • Validate model data before saving to database to get all database errors (via custom validators)
Unique validator response Exist validator response Exist validator response
Test coverage

e2e coverage (96%!)

e2e tests coverage

Installation

$ npm install
$ cp .env.example .env

Running the app

# migrate database
$ npm run migration:run

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Docker

  1. change DB_HOST in .env to DB_HOST=postgres
  2. run:
# run docker in background
$ docker-compose up -d

# run migrations
$ docker-compose exec dev npm run migration:run
  • Run tests with docker
# up postgres service
$ docker-compose up postgres

# run unit tests
$ docker-compose exec dev npm run test

# run e2e tests
$ docker-compose exec dev npm run test:e2e

Database

# migrate database
$ npm run migration:run

# revert last migration
$ npm run migration:revert

# generate migration
$ npm run migration:generate

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Roadmap

  • TypeORM
  • Migrations
  • CRUD User
  • CRUD Notification
  • JWT
    • Access Token
    • Refresh Token
  • Pagination
  • Unit tests
    • Use cases
    • Controllers
    • Coverage 100% (30%)
  • e2e tests
    • Coverage 100% (96% is almost 100% 👌)
  • Database constraints
  • Fix docker
    • Update README.md with docker steps
  • Run tests on Pull Requests
  • PR template

Support

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.

Stay in touch

License

Nest is MIT licensed.

About

NestJS Boilerplate. JWT, Swagger, TypeORM, Test e2e & unit, friendly errors, pagination

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published