khakimjanovich / nestjs-boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NestJS REST API boilerplate

Description

NestJS REST API boilerplate for typical project

Table of Contents

Features

  • Database (typeorm).
  • Seeding.
  • Config Service (@nestjs/config).
  • Sign in and sign up via email.
  • Admin and User roles.
  • File uploads. Support local and Amazon S3 drivers.
  • Swagger.
  • E2E and units tests.
  • Docker.
  • CI (Github Actions).

Comfortable development

git clone https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env

Change DATABASE_HOST=postgres to DATABASE_HOST=localhost

Database utils

Generate migration

npm run migration:generate -- src/database/migrations/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

Tests

# unit tests
npm run test

# e2e tests
npm run test:e2e

Tests 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


Languages

Language:TypeScript 100.0%