Skip to content

ByeongHunKim/NestJS-boilerplate

Repository files navigation

NestJS Boilerplate

Branch Naming Convention for Releases

For our release branches, we use the following naming convention:

release/v[version]
  • Example: release/v1.0.0
  • In this convention, [version] represents the release version. We adhere to the Semantic Versioning (SemVer) rules for our version numbers. For more details on SemVer, please visit Semantic Versioning.

Environment

  • Webstorm IDE
  • Node v16.x
  • NPM for the package manager
  • Postman for API endpoint testing and interaction
  • Postgres 15.3 with Prisma library and DBeaver Database Tool
  • Nestjs for basic webserver
  • Docker for the database and test env container (Install Docker Desktop recommended)
  • Default exposed ports below, You can change this by modifing infra/docker-compose.yml file
POSTGRES_DB: 5432
WEB_SERVER: 8080

Before Start

Step 1. Install Docker Desktop for running Postgres

Step 2. Set up infra

docker-compose -f infra/docker-compose.yml up -d

Environment Injection

Step 1. Setting domain for authentication

sudo vi /etc/hosts
# as-is : 127.0.0.1  localhost
# to-be
127.0.0.1  api.local.test.kr

Step 2. Copy env.example to .env

  • basic env values are already set up
cp .env.example .env

How to use

Step 1. Install dependencies

npm install

Step 2. Set up Prisma

npm run local:db:push
npm run local:db:generate-client
npm run local:db:seed

Step 3. Start server

npm run start:dev

Swagger docs

Step 1. Domain should be ready on your local (e.g api.local.test.kr)

Step 2. Start server

Step 3. you can check and testing apis on this link


Error codes

Common

  • B1000 -
  • B1100 -
  • B1200 - ConflictError - Error occurs when a user attempts to recreate data that already exists
  • B1300 - NotFoundError - Error occurs when requested resource could not be found