Skip to content

matheuslanduci/nestjs-boilerplate

Repository files navigation

NestJS Boilerplate

NestJS Boilerplate

A boilerplate for creating NestJS applications.

Features

Prerequisites

Installation

  • Clone the repository
  $ git clone https://github.com/matheuslanduci/nestjs-boilerplate.git
  • Install dependencies
  $ cd nestjs-boilerplate
  $ npm install
  • Copy the .env.example file to .env

  • Setup the database

  $ npm run db:setup
  • Run the application
  $ npm run start:dev

Endpoints

  • Get the endpoints from the folder workspaces. Modules available:

Import Patterns

There are some patterns to follow in your imports.

/**
 * First, the libraries installed in the project.
 */
import { Module } from '@nestjs/common'
import { PrismaClient } from '@prisma/client'
import { ObjectSchema } from 'joi'

/**
 * Then, import the shared components.
 */
import { Validate } from '@shared/decorators/validate.decorator'
import { Auth } from '@shared/decorators/auth.decorator'

/**
 * Then, import the providers and controllers required by the module.
 */
import { AppController } from './app.controller'
import { AppService } from './app.service'

/**
 * Then, import the manually created modules.
 */
import { AuthModule } from '../auth/auth.module'
import { UserModule } from '../users/users.module'

/**
 * Finally, import the other files.
 */
import { CreateUserDto } from './dto/create-user.dto'
import { IUser } from './interfaces/user.interface'