/nestjs-docker-prisma-mysql

Application template for NestJS + Docker + Prisma + MySQL

Primary LanguageTypeScript

nestjs-docker-prisma-mysql

Node.js Testing Static analysis checking

Nest Logo

Application template for NestJS + Docker + Prisma + MySQL

Setup

# install
$ yarn

# Setup env file for database
$ cp prisma/.env.example prisma/.env

# run containers
$ yarn dev

# setup database ( sync database schema )
$ docker exec -it app yarn db:apply

# insert seed data
$ docker exec -it app yarn db:seed

Currently HMR is not enabled, so the server will reload on every file change.

Use Prisma Studio

You can view / edit DB tables using Prisma Studio.

Once you run yarn dev, you can open it in http://localhost:5555.

Migration (Development)

Log in to the app container and run

$ docker exec -it app yarn db:migrate:dev

Swagger

Swagger UI is available on http://localhost:3000/api

Test

# unit tests
$ docker exec -it app yarn test

# e2e tests
$ docker exec -it app yarn test:e2e

# test coverage
$ docker exec -it app yarn test:cov