Skip to content

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.

application

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]

Options

OptionTypeDescriptionDefault
--e2eTestRunnerstringTest runner to use for end to end (e2e) tests"jest"
--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.
--setParserOptionsProjectbooleanWhether or not to configure the ESLint parserOptions.project option. We do not do this by default for lint performance reasons.false
--skipFormatbooleanSkip formatting files.false
--skipPackageJsonbooleanDo not add dependencies to package.json.false
--standaloneConfigbooleanSplit the project configuration into <projectRoot>/project.json rather than including it inside workspace.json.true
--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.

class

Nest Class Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest class language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

controller

Nest Controller Options Schema.

Usage:

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

Arguments:

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

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"

decorator

Nest Decorator Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest decorator language.
--skipFormatbooleanSkip formatting files.false

filter

Nest Filter Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest filter language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

gateway

Nest Gateway Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest gateway language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

guard

Nest Guard Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest guard language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

interceptor

Nest Interceptor Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest interceptor language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

interface

Nest Interface Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--skipFormatbooleanSkip formatting files.false

library

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]

Options

OptionTypeDescriptionDefault
--buildablebooleanGenerate a buildable library.false
--controllerbooleanInclude a controller with the library.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
--setParserOptionsProjectbooleanWhether or not to configure the ESLint “parserOptions.project” option. We do not do this by default for lint performance reasons.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.

middleware

Nest Middleware Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest middleware language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

module

Nest Module Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest module language.
--modulestringThe path to import the module.
--skipFormatbooleanSkip formatting files.false
--skipImportbooleanFlag to skip the module import.false

pipe

Nest Pipe Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest pipe language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

provider

Nest Provider Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest provider language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

resolver

Nest Resolver Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest resolver language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

resource

Nest Resource Options Schema.

Usage:

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

Arguments:

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

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"

service

Nest Service Options Schema.

Usage:

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

Arguments:

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

Options

OptionTypeDescriptionDefault
--languagestringNest service language.
--skipFormatbooleanSkip formatting files.false
--unitTestRunnerstringTest runner to use for unit tests."jest"

Getting Help

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

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