@nx/nest - Generators
The @nx/nest plugin provides various generators to help you create and configure nest projects within your Nx workspace. Below is a complete reference for all available generators and their options.
For an overview of the plugin and setup instructions, see the @nx/nest introduction.
application
Section titled “application”Nx Application Options Schema.
Usage:
nx generate @nx/nest:application [options]Aliases: app
Arguments:
nx generate @nx/nest:application <directory> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--e2eTestRunner | string | Test runner to use for end to end (e2e) tests | "jest" |
--enableTypedLinting | boolean | Whether to enable typed linting. For flat configs, this configures the recommended parserOptions.projectService and tsconfigRootDir. For legacy .eslintrc configs, this configures parserOptions.project. We do not enable this by default for lint performance reasons. | false |
--frontendProject | string | Frontend project that needs to access this application. This sets up proxy configuration. | |
--linter | string | The tool to use for running lint checks. | "none" |
--name | string | The name of the application. | |
--setParserOptionsProject | boolean | Deprecated alias for enableTypedLinting. | false |
--skipFormat | boolean | Skip formatting files. | false |
--skipPackageJson | boolean | Do not add dependencies to package.json. | false |
--strict | boolean | Adds strictNullChecks, noImplicitAny, strictBindCallApply, forceConsistentCasingInFileNames and noFallthroughCasesInSwitch to tsconfig. | false |
--tags | string | Add tags to the application (used for linting). | |
--unitTestRunner | string | Test runner to use for unit tests. | "none" |
--useProjectJson | boolean | Use a project.json configuration file instead of inlining the Nx configuration in the package.json file. |
Nest Class Options Schema.
Usage:
nx generate @nx/nest:class [options]Arguments:
nx generate @nx/nest:class <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest class language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
controller
Section titled “controller”Nest Controller Options Schema.
Usage:
nx generate @nx/nest:controller [options]Arguments:
nx generate @nx/nest:controller <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest controller language. | |
--module | string | Allows specification of the declaring module. | |
--skipFormat | boolean | Skip formatting files. | false |
--skipImport | boolean | Flag to skip the module import. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
decorator
Section titled “decorator”Nest Decorator Options Schema.
Usage:
nx generate @nx/nest:decorator [options]Arguments:
nx generate @nx/nest:decorator <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest decorator language. | |
--skipFormat | boolean | Skip formatting files. | false |
filter
Section titled “filter”Nest Filter Options Schema.
Usage:
nx generate @nx/nest:filter [options]Arguments:
nx generate @nx/nest:filter <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest filter language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
gateway
Section titled “gateway”Nest Gateway Options Schema.
Usage:
nx generate @nx/nest:gateway [options]Arguments:
nx generate @nx/nest:gateway <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest gateway language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
Nest Guard Options Schema.
Usage:
nx generate @nx/nest:guard [options]Arguments:
nx generate @nx/nest:guard <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest guard language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
interceptor
Section titled “interceptor”Nest Interceptor Options Schema.
Usage:
nx generate @nx/nest:interceptor [options]Arguments:
nx generate @nx/nest:interceptor <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest interceptor language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
interface
Section titled “interface”Nest Interface Options Schema.
Usage:
nx generate @nx/nest:interface [options]Arguments:
nx generate @nx/nest:interface <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--skipFormat | boolean | Skip formatting files. | false |
library
Section titled “library”Create a NestJS Library for Nx.
Usage:
nx generate @nx/nest:library [options]Aliases: lib
Arguments:
nx generate @nx/nest:library <directory> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--buildable | boolean | Generate a buildable library. | false |
--controller | boolean | Include a controller with the library. | false |
--enableTypedLinting | boolean | Whether to enable typed linting. For flat configs, this configures the recommended parserOptions.projectService and tsconfigRootDir. For legacy .eslintrc configs, this configures parserOptions.project. We do not enable this by default for lint performance reasons. | false |
--global | boolean | Add the Global decorator to the generated module. | false |
--importPath | string | The library name used to import it, like @myorg/my-awesome-lib. Must be a valid npm name. | |
--linter | string | The tool to use for running lint checks. | "none" |
--name | string | Library name. | |
--publishable | boolean | Create a publishable library. | |
--service | boolean | Include a service with the library. | false |
--setParserOptionsProject | boolean | Deprecated alias for enableTypedLinting. | false |
--skipFormat | boolean | Skip formatting files. | false |
--skipPackageJson | boolean | Do not add dependencies to package.json. | false |
--skipTsConfig | boolean | Do not update tsconfig.base.json for development experience. | false |
--strict | boolean | Whether to enable tsconfig strict mode or not. | true |
--tags | string | Add tags to the library (used for linting). | |
--target | string | The ES target, Nest suggest using es2021 or higher. | "es2021" |
--testEnvironment | string | The test environment for jest, for node applications this should stay as node unless doing DOM testing. | "node" |
--unitTestRunner | string | Test runner to use for unit tests. | "none" |
--useProjectJson | boolean | Use a project.json configuration file instead of inlining the Nx configuration in the package.json file. |
middleware
Section titled “middleware”Nest Middleware Options Schema.
Usage:
nx generate @nx/nest:middleware [options]Arguments:
nx generate @nx/nest:middleware <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest middleware language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
module
Section titled “module”Nest Module Options Schema.
Usage:
nx generate @nx/nest:module [options]Arguments:
nx generate @nx/nest:module <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest module language. | |
--module | string | The path to import the module. | |
--skipFormat | boolean | Skip formatting files. | false |
--skipImport | boolean | Flag to skip the module import. | false |
Nest Pipe Options Schema.
Usage:
nx generate @nx/nest:pipe [options]Arguments:
nx generate @nx/nest:pipe <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest pipe language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
provider
Section titled “provider”Nest Provider Options Schema.
Usage:
nx generate @nx/nest:provider [options]Arguments:
nx generate @nx/nest:provider <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest provider language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
resolver
Section titled “resolver”Nest Resolver Options Schema.
Usage:
nx generate @nx/nest:resolver [options]Arguments:
nx generate @nx/nest:resolver <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest resolver language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
resource
Section titled “resource”Nest Resource Options Schema.
Usage:
nx generate @nx/nest:resource [options]Arguments:
nx generate @nx/nest:resource <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--crud | boolean | When true, CRUD entry points are generated. | true |
--skipFormat | boolean | Skip formatting files. | false |
--skipImport | boolean | Flag to skip the module import. | false |
--type | string | The transport layer. | "rest" |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
service
Section titled “service”Nest Service Options Schema.
Usage:
nx generate @nx/nest:service [options]Arguments:
nx generate @nx/nest:service <path> [options]Options
Section titled “Options”| Option | Type | Description | Default |
|---|---|---|---|
--language | string | Nest service language. | |
--skipFormat | boolean | Skip formatting files. | false |
--unitTestRunner | string | Test runner to use for unit tests. | "jest" |
Getting Help
Section titled “Getting Help”You can get help for any generator by adding the --help flag:
nx generate @nx/nest:<generator> --help