πŸ“… You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP β†’
Socket
Sign inDemoInstall
Socket

scaffold-nestjs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scaffold-nestjs

Boilerplate generator for Nest.js

0.3.1
latest
Source
npm
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
Β 
Created
Source

Scaffold Nest.js

Description

This generator will help you create a Nest.js application. You just need to answer the questions and get a ready-made application template.

Project Overview

  • Nest.js 9
  • Eslint
  • Docker
  • Husky
  • Supports MongoDB, MySql, Postgres
  • Supports Mongoose, Prisma, TypeORM, MikroORM
  • Ability to select services: Keycloak, MinIO and Novu

Installation

First, generate your new project:

npx scaffold-nestjs

Run your generated application:

cd <project name>
docker-compose up -d

Options

OptionsDescriptionExample
skip-installThis option disables installation of dependencies after code generation.npx scaffold-nestjs --skip-install
no-interactiveThis option disables answering questions in interactive mode.npx scaffold-nestjs --no-interactive
projectThis option allows you to set the name of the project (default is nest-js-project).npx scaffold-nestjs --project-name=nest-js-project
should-overwriteThis option allows you to overwrite an existing folder.npx scaffold-nestjs --should-overwrite
databaseThis option allows you to set the database.
Allowed values: mongo, mysql or postgres.
npx scaffold-nestjs --database=mongo
ormThis option allows you to set the orm.
Allowed values for MongoDB: mongoose or prisma.
Allowed values for MySql and Postgres: prisma, mikroorm or typeorm.
npx scaffold-nestjs --orm=mongoose
no-need-authThis option disables the generation of authorization components.npx scaffold-nestjs --no-need-auth
authThis option allows you to set the authorization option.
Allowed values: jwt.
npx scaffold-nestjs --auth=jwt
servicesThis option allows you to add various services to the project.
Allowed values: keycloak, minio, novu.
npx scaffold-nestjs --services=keycloak,minio

For example:

npx scaffold-nestjs --no-interactive \
  --should-overwrite \
  --project-name=nest-js-project \
  --database=mongo \
  --orm=mongoose \
  --services=keycloak,novu

App skeleton

β”œβ”€β”€ src
β”‚   β”œβ”€β”€ database
β”‚   β”‚   β”œβ”€β”€ migrations
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ database.config.ts
β”‚   β”‚   └── database-factory.service.ts
β”‚   β”œβ”€β”€ decorators
β”‚   β”‚   β”œβ”€β”€ auth-bearer.decorator.ts
β”‚   β”‚   β”œβ”€β”€ auth.decorator.ts
β”‚   β”‚   β”œβ”€β”€ roles.decorator.ts
β”‚   β”‚   └── serialization.decorator.ts
β”‚   β”œβ”€β”€ exceptions
β”‚   β”‚   └── validation.exceptions.ts
β”‚   β”œβ”€β”€ filters
β”‚   β”‚   β”œβ”€β”€ all-exceptions.filter.ts
β”‚   β”‚   β”œβ”€β”€ bad-request-exception.filter.ts
β”‚   β”‚   β”œβ”€β”€ forbidden-exception.filter.ts
β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”œβ”€β”€ not-found-exception.filter.ts
β”‚   β”‚   β”œβ”€β”€ unauthorized-exception.filter.ts
β”‚   β”‚   └── validation-exceptions.filter.ts
β”‚   β”œβ”€β”€ guards
β”‚   β”‚   β”œβ”€β”€ jwt-access.guard.ts
β”‚   β”‚   β”œβ”€β”€ jwt-refresh.guard.ts
β”‚   β”‚   └── roles.guard.ts
β”‚   β”œβ”€β”€ interceptors
β”‚   β”‚   β”œβ”€β”€ serialization.interceptor.ts
β”‚   β”‚   └── wrap-response.interceptor.ts
β”‚   β”œβ”€β”€ interfaces
β”‚   β”‚   └── exception-response.interface.ts
β”‚   β”œβ”€β”€ modules
β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”‚   β”œβ”€β”€ dtos
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ jwt-token.dto.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ refresh-token.dto.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ login.dto.ts
β”‚   β”‚   β”‚   β”‚   └── signup.dto.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ interfaces
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ decoded-user.interface.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ jwt-strategy-validate.interface.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ login-payload.interface.ts
β”‚   β”‚   β”‚   β”‚   └── validate-user-output.interface.ts
β”‚   β”‚   β”‚   └── strategies
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ jwt-access.strategy.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ jwt-refresh.strategy.ts
β”‚   β”‚   β”‚   β”‚   └── public.strategy.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.module.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.repository.ts
β”‚   β”‚   β”‚   └── auth.service.ts
β”‚   β”‚   └── user
β”‚   β”‚       β”œβ”€β”€ dtos
β”‚   β”‚       β”‚   β”œβ”€β”€ update-user.dto.ts
β”‚   β”‚       β”‚   └── user-response.dto.ts
β”‚   β”‚       β”œβ”€β”€ user.entity.ts
β”‚   β”‚       β”œβ”€β”€ user.controller.ts
β”‚   β”‚       β”œβ”€β”€ user.module.ts
β”‚   β”‚       β”œβ”€β”€ user.repository.ts
β”‚   β”‚       └── user.service.ts
β”‚   β”œβ”€β”€ shared
β”‚   β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”‚   β”œβ”€β”€ api-config.service.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ keycloak.service.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ minio.service.ts
β”‚   β”‚   β”‚   └── novu.service.ts
β”‚   β”‚   └── shared.module.ts
β”‚   β”œβ”€β”€ app.module.ts
β”‚   └── main.ts
β”œβ”€β”€ .dockerignore
β”œβ”€β”€ .env
β”œβ”€β”€ .eslintrc.js
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .prettierrc
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ nest-cli.json
β”œβ”€β”€ package.json
β”œβ”€β”€ README.md
β”œβ”€β”€ tsconfig.build.json
└── tsconfig.json

Swagger documentation will be available on route:

http://localhost:3000/api

Keywords

nest.js

FAQs

Package last updated on 17 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts