Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@nestjs/schematics
Advanced tools
The @nestjs/schematics package is a collection of schematics for NestJS, a framework for building efficient, reliable and scalable server-side applications. This package provides a set of tools to generate various parts of a NestJS application, such as modules, controllers, services, and more, following best practices and reducing the amount of boilerplate code that developers need to write.
Generate a new application
This command sets up a new NestJS project with all the necessary configuration and dependencies.
nest new project-name
Generate a module
This command creates a new module in the NestJS application with the name 'users'.
nest generate module users
Generate a controller
This command generates a new controller with the name 'users' within the NestJS application, which can handle incoming HTTP requests.
nest generate controller users
Generate a service
This command creates a new service with the name 'users', which can contain business logic and can be injected into controllers or other services.
nest generate service users
Generate a guard
This command generates a new guard named 'auth', which can be used to implement authentication and authorization logic in the application.
nest generate guard auth
Generate a filter
This command creates a new exception filter named 'common', which can be used to handle exceptions in a consistent way across the application.
nest generate filter common
Generate an interceptor
This command generates a new interceptor named 'logging', which can be used to intercept incoming requests or outgoing responses for tasks like logging or transforming data.
nest generate interceptor logging
Generate a pipe
This command creates a new pipe named 'validation', which can be used to perform validation and data transformation on the request objects.
nest generate pipe validation
Generate a middleware
This command generates a new middleware named 'logger', which can be used to execute code before the route handler is called, such as logging request details.
nest generate middleware logger
Similar to @nestjs/schematics, the @angular/cli package is used for generating and scaffolding Angular applications. It provides a wide range of schematics for components, services, modules, and more. While @nestjs/schematics is focused on server-side applications with NestJS, @angular/cli is tailored for client-side Angular applications.
Create-react-app is a scaffolding tool for React applications. It sets up a new React project with sensible defaults. Unlike @nestjs/schematics, which provides fine-grained generation of individual elements, create-react-app is more about initializing a new project structure.
Yeoman is a generic scaffolding system that allows the creation of any kind of app. It has a variety of generators for different frameworks and libraries. While @nestjs/schematics is specific to NestJS, Yeoman is more versatile and can be extended with custom generators for different purposes.
Slush is a scaffolding tool similar to Yeoman but built on top of Gulp.js. It allows developers to create their own scaffolding tools using Gulp tasks. Slush is more general-purpose compared to @nestjs/schematics, which is specialized for NestJS applications.
Nestjs project and architecture element generation based on @angular-dekit/schematics engine
git clone https://github.com/nestjs/schematics.git
in the schematics folder :
make prepare
make build
in the schematics folder :
npm install
rm -rf schematics && mkdir schematics
npm run -s build
cp -R src/* schematics
cp -R LICENSE package.json package-lock.json README.md .npmrc schematics
find src -name '*.js' -delete
install @angular-devkit/schematics-cli globally.
run schematics [path_to_nestjs_schematics]:<nestjs_schematic_name> [...options]
Option | description | required | default value |
---|---|---|---|
directory | The directory name to create the app in. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the controller. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the exception. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the guard. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the interceptor. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the middleware. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the module. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the pipe. | true |
Option | description | required | default value |
---|---|---|---|
name | The name of the service. | true |
FAQs
Nest - modern, fast, powerful node.js web framework (@schematics)
The npm package @nestjs/schematics receives a total of 2,254,342 weekly downloads. As such, @nestjs/schematics popularity was classified as popular.
We found that @nestjs/schematics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.