Home

Awesome

Nest

Description

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

Technologies implemented:

Prerequisites

Installation

$ npm install

Setting up the database for development and test

PostgreSQL database connection options are shown in the following table:

OptionDevelopmentTest
Hostlocalhostlocalhost
Port54325432
Usernamepostgrespostgres
Passwordpostgrespostgres
Databasenestnest_test

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

Other commands

# formatting code
$ npm run format

# run linter
$ npm run lint

# create database
$ npm run db:create

# run migrations
$ npm run db:migrate

# run seeders
$ npm run db:seed-dev

# reset database
$ npm run db:reset

# drop database
$ npm run db:drop

Run production configuration

NODE_ENV=production \
DATABASE_HOST=db.host.com \
DATABASE_PORT=5432 \
DATABASE_USER=user \
DATABASE_PASSWORD=pass \
DATABASE_DATABASE=database \
JWT_PRIVATE_KEY=jwtPrivateKey \
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/documentation