Skip to content

Latest commit

 

History

History
143 lines (102 loc) · 3.64 KB

File metadata and controls

143 lines (102 loc) · 3.64 KB

NestJs Boilerplate

NestJS Prisma PNPM Postgres Redis Docker Jest Swagger JWT RxJS TypeScript ESLint

Description

NestJs Boilerplate with Typescript, Prisma, Postgres,...

by Johan Pham

Installation

There are 2 way to run the application:

Install and run in development mode

Install dependency

# development
$ pnpm install

Run necessary container

# start Postgres and Redis
$ pnpm d:up

# generate Prisma schema
$ pnpm prisma:generate

# Copy .env
$ cp .env.example .env

Run the app

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

Test

# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov

All in one command with Docker

Run the app with Docker compose

# copy environment
$ cp .env.example .env.production.local

# run container
$ pnpm d:up:prod

Check the log

# check container is running
$ docker ps

# check container logs
$ docker logs -f <container_id>

Prisma

  • Generate
# generate Prisma schema
$ pnpm prisma:generate
  • Migration
# generate migration file
$ pnpm mig:run

# apply migration file
$ pnpm mig:run

# undo migration
$ pnpm mig:reset

# check status change
$ pnpm mig:status
  • Seed
# run seeder
$ pnpm seed:run