Skip to content

vseriousv/nestjs-typeorm-template

Repository files navigation

Nest

Description

Starter kit project made with Nest that demonstrates CRUD user, JWT authentication, CRUD posts.

Technologies implemented:

Prerequisites

Installation

$ yarn install

Setting up the database for development and test

Copy .env-example to .env

$ cp .env-example .env

PostgreSQL database connection options are shown in the following table:

Option Development Test
Host localhost localhost
Port 5432 5432
Username postgres postgres
Password postgres postgres
Database nest nest_test

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

Other commands

# formatting code
$ yarn format

# generate migrations {name-migration} - change the name for your migration
$ yarn migration:generate -- db/migrations/{name-migration}

# run migrations
$ yarn migration:run 

# revert one migration from database
$ yarn migration:revert

Run production configuration

NODE_ENV=development \
DB_HOST=127.0.0.1 \
DB_PORT=5432 \
DB_USERNAME=postgres \
DB_PASSWORD=password \
DB_NAME=nestjs_typeorm_template \
JWT_SECRET=jwtSuperSecret \

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/v1/docs

Author template

Telegram Telegram Instagram YouTube LinkedIn

Hey there 👋 I'm a Senior Backend Developer specializing in blockchain projects. I work on the development of backend systems and DevOps in blockchain companies. I'm also passionate about growing the KnowYourBackend community.