When you utilize the generate
feature within the CLI, you have the ability to create a new Nest element. This functionality is powered by Angular Schematics. By generating a command, controller, service, and more, you are essentially scaffolding it using an Angular Schematic. These schematics are contained in a distinct package known as a collection. The set of schematics provided by NestJS can be found in the @nestjs/schematics package.
The nest generate
or nest g
command serves as an alias for running an Angular Schematic. By default, NestJS relies on its own set of schematics. If you wish to develop your own, you must establish your own package (collection). Subsequently, you can reference this collection from the Nest CLI.
nest generate my-schematic --collection @my/collection
Alternatively, you have the option to directly use your custom schematics within the Angular CLI.
ng generate my-schematic:collection:my-schematic-name