Skip to content

@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.

Nx Application Options Schema.

Usage:

Terminal window
nx generate @nx/nest:application [options]

Aliases: app

Arguments:

Terminal window
nx generate @nx/nest:application <directory> [options]
OptionTypeDescriptionDefault
--e2eTestRunnerstringTest runner to use for end to end (e2e) tests"jest"
--enableTypedLintingbooleanWhether 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
--frontendProjectstringFrontend project that needs to access this application. This sets up proxy configuration.
--linterstringThe tool to use for running lint checks."none"
--namestringThe name of the application.
--setParserOptionsProjectbooleanDeprecated alias for enableTypedLinting.false
--skipFormatbooleanSkip formatting files.false
--skipPackageJsonbooleanDo not add dependencies to package.json.false
--strictbooleanAdds strictNullChecks, noImplicitAny, strictBindCallApply, forceConsistentCasingInFileNames and noFallthroughCasesInSwitch to tsconfig.false
--tagsstringAdd tags to the application (used for linting).
--unitTestRunnerstringTest runner to use for unit tests."none"
--useProjectJsonbooleanUse a project.json configuration file instead of inlining the Nx configuration in the package.json file.

Nest Class Options Schema.

Usage:

Terminal window
nx generate @nx/nest:class [options]

Arguments:

Terminal window
nx generate @nx/nest:class <path> [options]
OptionTypeDescriptionDefault
--languagestringNest class language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Controller Options Schema.

Usage:

Terminal window
nx generate @nx/nest:controller [options]

Arguments:

Terminal window
nx generate @nx/nest:controller <path> [options]
OptionTypeDescriptionDefault
--languagestringNest controller language.
--modulestringAllows specification of the declaring module.
--skipFormatbooleanSkip formatting files.false
--skipImportbooleanFlag to skip the module import.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Decorator Options Schema.

Usage:

Terminal window
nx generate @nx/nest:decorator [options]

Arguments:

Terminal window
nx generate @nx/nest:decorator <path> [options]
OptionTypeDescriptionDefault
--languagestringNest decorator language.
--skipFormatbooleanSkip formatting files.false

Nest Filter Options Schema.

Usage:

Terminal window
nx generate @nx/nest:filter [options]

Arguments:

Terminal window
nx generate @nx/nest:filter <path> [options]
OptionTypeDescriptionDefault
--languagestringNest filter language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Gateway Options Schema.

Usage:

Terminal window
nx generate @nx/nest:gateway [options]

Arguments:

Terminal window
nx generate @nx/nest:gateway <path> [options]
OptionTypeDescriptionDefault
--languagestringNest gateway language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Guard Options Schema.

Usage:

Terminal window
nx generate @nx/nest:guard [options]

Arguments:

Terminal window
nx generate @nx/nest:guard <path> [options]
OptionTypeDescriptionDefault
--languagestringNest guard language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Interceptor Options Schema.

Usage:

Terminal window
nx generate @nx/nest:interceptor [options]

Arguments:

Terminal window
nx generate @nx/nest:interceptor <path> [options]
OptionTypeDescriptionDefault
--languagestringNest interceptor language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Interface Options Schema.

Usage:

Terminal window
nx generate @nx/nest:interface [options]

Arguments:

Terminal window
nx generate @nx/nest:interface <path> [options]
OptionTypeDescriptionDefault
--skipFormatbooleanSkip formatting files.false

Create a NestJS Library for Nx.

Usage:

Terminal window
nx generate @nx/nest:library [options]

Aliases: lib

Arguments:

Terminal window
nx generate @nx/nest:library <directory> [options]
OptionTypeDescriptionDefault
--buildablebooleanGenerate a buildable library.false
--controllerbooleanInclude a controller with the library.false
--enableTypedLintingbooleanWhether 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
--globalbooleanAdd the Global decorator to the generated module.false
--importPathstringThe library name used to import it, like @myorg/my-awesome-lib. Must be a valid npm name.
--linterstringThe tool to use for running lint checks."none"
--namestringLibrary name.
--publishablebooleanCreate a publishable library.
--servicebooleanInclude a service with the library.false
--setParserOptionsProjectbooleanDeprecated alias for enableTypedLinting.false
--skipFormatbooleanSkip formatting files.false
--skipPackageJsonbooleanDo not add dependencies to package.json.false
--skipTsConfigbooleanDo not update tsconfig.base.json for development experience.false
--strictbooleanWhether to enable tsconfig strict mode or not.true
--tagsstringAdd tags to the library (used for linting).
--targetstringThe ES target, Nest suggest using es2021 or higher."es2021"
--testEnvironmentstringThe test environment for jest, for node applications this should stay as node unless doing DOM testing."node"
--unitTestRunnerstringTest runner to use for unit tests."none"
--useProjectJsonbooleanUse a project.json configuration file instead of inlining the Nx configuration in the package.json file.

Nest Middleware Options Schema.

Usage:

Terminal window
nx generate @nx/nest:middleware [options]

Arguments:

Terminal window
nx generate @nx/nest:middleware <path> [options]
OptionTypeDescriptionDefault
--languagestringNest middleware language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Module Options Schema.

Usage:

Terminal window
nx generate @nx/nest:module [options]

Arguments:

Terminal window
nx generate @nx/nest:module <path> [options]
OptionTypeDescriptionDefault
--languagestringNest module language.
--modulestringThe path to import the module.
--skipFormatbooleanSkip formatting files.false
--skipImportbooleanFlag to skip the module import.false

Nest Pipe Options Schema.

Usage:

Terminal window
nx generate @nx/nest:pipe [options]

Arguments:

Terminal window
nx generate @nx/nest:pipe <path> [options]
OptionTypeDescriptionDefault
--languagestringNest pipe language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Provider Options Schema.

Usage:

Terminal window
nx generate @nx/nest:provider [options]

Arguments:

Terminal window
nx generate @nx/nest:provider <path> [options]
OptionTypeDescriptionDefault
--languagestringNest provider language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Resolver Options Schema.

Usage:

Terminal window
nx generate @nx/nest:resolver [options]

Arguments:

Terminal window
nx generate @nx/nest:resolver <path> [options]
OptionTypeDescriptionDefault
--languagestringNest resolver language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Resource Options Schema.

Usage:

Terminal window
nx generate @nx/nest:resource [options]

Arguments:

Terminal window
nx generate @nx/nest:resource <path> [options]
OptionTypeDescriptionDefault
--crudbooleanWhen true, CRUD entry points are generated.true
--skipFormatbooleanSkip formatting files.false
--skipImportbooleanFlag to skip the module import.false
--typestringThe transport layer."rest"
--unitTestRunnerstringTest runner to use for unit tests."jest"

Nest Service Options Schema.

Usage:

Terminal window
nx generate @nx/nest:service [options]

Arguments:

Terminal window
nx generate @nx/nest:service <path> [options]
OptionTypeDescriptionDefault
--languagestringNest service language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

You can get help for any generator by adding the --help flag:

Terminal window
nx generate @nx/nest:<generator> --help