0.3.4 • Published 8 months ago

nestjs-crud-schematics v0.3.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

nestjs-crud-schematics

This is an opinionated NestJS schematics for generating Mongoose and TypeORM entities, DTOs, controllers, services, and repositories.

asciicast

šŸ‘¾ These are the main differences between this generator and others:

  • It only relies on offical and well-known packages
  • It also generates the fields/properties for the entity

Usage

# Install the schematics
npm i --save-dev nestjs-crud-schematics

# Generate a new resource (controller + service + repository)
nest g -c nestjs-crud-schematics resource

Features

  • Supports Mongoose or TypeORM (with Postgres)
  • Installs all required NPM packages and NestJS modules
  • Generates a controller, injecting a service
  • Generates a service, injecting a repository
  • Generates a custom repository serializing Mongoose documents into entities
  • Generates the entity with either Mongoose or TypeORM decorators
  • Generates DTOs with basic validators
  • Generates Swagger documentation
  • Generates unit tests with automock and full coverage

Development

Create a new NestJS project, which will be ignored by the .gitignore file.

# Link the local development build of the schematics
cd nestjs-crud-schematics
npm install
npm build
npm link

# Create new example application inside the current directory
nest new example -p npm
cd example
npm link nestjs-crud-schematics

Run the schematics:

nest g -c nestjs-crud-schematics resource --debug
0.3.0

10 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.4

8 months ago

0.3.3

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago