Skip to content
/ nest-api-template Public template

This is a template for a NestJS API. It is based on the Nest

Notifications You must be signed in to change notification settings

fermelli/nest-api-template

Repository files navigation

NestJS API Template

Description

This is a template for a NestJS API. It is based on the Nest

Requirements

  • Node 16.0.0 or later
  • Yarn 1.22.10 or later
  • MySQL 8.0.25 or later

Optional:

  • Docker 25.0.0 or later

Installation

$ yarn install

Configuration

Create a .env file in the root of the project with the content of the .env.example file.

cp .env.example .env

Edit the .env file with the appropriate values.

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Docker for production

# Build the image
$ docker build -t nest-api-template .

# Run the container
$ docker compose up

Migrations

# Create a new migration

# Yarn
$ npm_config_migration_name=[nombre_de_la_migracion] yarn run migration:create

# NPM (recommended)
$ npm run migration:create --migration_name=[nombre_de_la_migracion]

# Run the migrations
$ yarn run migration:run

# Revert the migrations
$ yarn run migration:revert

Info

Features

  • Authentication with JWT
    • Sign up
    • Sign in
    • Me
  • Authorization with roles and permissions
    • Permission guard
    • Permission decorator
    • Public decorator
  • User management
    • Create user
    • Get users
    • Get by email
    • Get user
    • Delete user
    • Soft delete user
    • Restore user
    • Assign roles
    • Assign permissions
    • Get all permissions (permissions from roles and direct permissions)
  • Role management
    • Create role
    • Get roles
    • Get role
    • Update role
    • Delete role
    • Assign permissions
  • Permission management
    • Get permissions
    • Get permission

About

This is a template for a NestJS API. It is based on the Nest

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages