Skip to content
/ nestjs-template Public template

Starter kit project made with Nest and nestjs-sequelize-typescript that demonstrate CRUD use

Notifications You must be signed in to change notification settings

hjh1004/nestjs-template

Repository files navigation

Description

Starter kit project made with Nest and nestjs-sequelize-typescript that demonstrate CRUD use and e2e tests.

Technologies implemented:

Prerequisites

Installation

$ npm install

Setup Database Mysql

Run mysql container

docker-compose up

Connect MySQL console

docker exec -it <CONTAINER_ID>  mysql -uroot -p

Create account and set authorization

CREATE USER 'root'@'172.17.0.1' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'172.17.0.1' WITH GRANT OPTION;

Apply and exit

flush privileges;
exit

Setting up the database for development and test

MySQL database connection options are shown in the following table:

Option Local(Test)
Host localhost
Port 3306
Username user
Password password
Database database

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# e2e tests
$ npm run test:e2e

Run production configuration

NODE_ENV=production \
URL=host.com \
PORT=3000 \
DB_HOST=db.host.com \
DB_PORT=3306 \
DB_USER=user \
DB_PASSWORD=pass \
DB_DATABASE=database \
ts-node -r tsconfig-paths/register src/main.ts

Swagger API docs

This project uses the Nest swagger module for API documentation. NestJS Swagger - www.swagger.io
Swagger docs will be available at localhost:3000/docs

Todo

  • Authentication
  • Authorization
  • Helmet
  • CORS
  • Microservices

Reference repository

https://github.com/kentloog/nestjs-sequelize-typescript

About

Starter kit project made with Nest and nestjs-sequelize-typescript that demonstrate CRUD use

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published