francishero / nestjs-boilerplate

NestJS boilerplate. Auth, TypeORM, Postgres, Mailing, I18N, Docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NestJS REST API boilerplate

Description

NestJS REST API boilerplate for typical project

Features

Quick run

cp env-example .env

docker-compose up -d

For check status run

docker-compose logs

Links

Comfortable development

cp env-example .env

Change DATABASE_HOST=postgres to DATABASE_HOST=localhost

Change MAIL_HOST=maildev to MAIL_HOST=localhost

Run additional container:

docker-compose up -d postgres adminer maildev redis
npm install

npm run migration:run

npm run seed:run

npm run start:dev

Database utils

Generate migration

npm run migration:generate -- CreateNameTable

Run migration

npm run migration:run

Revert migration

npm run migration:revert

Drop all tables in database

npm run schema:drop

Run seed

npm run seed:run

Test

# unit tests
npm run test

# e2e tests
npm run test:e2e

Test in Docker

docker-compose -f docker-compose.ci.yaml --env-file env-example -p ci up --build --exit-code-from api && docker-compose -p ci rm -svf

Test benchmarking

docker run --rm jordi/ab -n 100 -c 100 -T application/json -H "Authorization: Bearer USER_TOKEN" -v 2 http://<server_ip>:3000/api/v1/users

About

NestJS boilerplate. Auth, TypeORM, Postgres, Mailing, I18N, Docker.


Languages

Language:TypeScript 90.0%Language:Shell 6.2%Language:Handlebars 2.4%Language:JavaScript 1.0%Language:Dockerfile 0.4%