Skip to content

ttemple06/nestjs-server

Repository files navigation

Description

A sample NestJs app built using NodeJs/TypeScript, the Nest framework, a Sequelize ORM Integration package called @nestjs/sequelize, and MySQL RDBMS. Includes Jest unit tests with sequelize-mock and e2e integration tests via SuperTest.

  • Uses the openapi-express-validator and @nestjs/swagger modules to validate request/response DTOs rather than the class-validator which only handles validation on requests
  • The swagger document is available in both JSON and YAML, and the YAML document is written to the repo for source control/maintenance.
  • Uses the @nestjs/swagger plugin to avoid having to add @ApiProperty() in every DTO
  • Uses Sequelize ORM and the @nestjs/sequelize TypeScript wrapper to utilize a DatabaseModule and custom components for a MySQL database.
  • Uses sequelize-mock for Jest mock unit testing
  • Uses node config npm i config to configure the application settings

Simple ERD Diagram

Screen Shot 2023-03-12 at 12 19 09 PM

When the app is running, you can view the swagger documentation: Screenshot 2023-03-05 at 20-35-01 Swagger UI

Prerequisites

  • Install NodeJs and NestJs Framework
  • Install MySQL
  • Obtain the default configuration settings file

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

License

Nest is MIT licensed.

About

nestjs-server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published