Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt

Use this file to discover all available pages before exploring further.

The Nx CLI (nx) is the primary interface for running tasks, generating code, managing migrations, and visualizing your workspace. Every command follows the pattern:
nx <command> [options]

Getting help

Pass --help to any command to see its options and usage:
nx --help
nx run --help
nx affected --help
To list available generators for a plugin:
nx list @nx/react

Commands

run

Run a single target for a project. Supports configuration overrides and cache control.

generate

Scaffold or update source code using a generator from any installed Nx plugin.

affected

Run a target only for projects that are affected by recent changes in your git history.

run-many

Run one or more targets across a specific set of projects in the workspace.

migrate

Update Nx and its plugins, and apply the resulting code migrations automatically.

release

Orchestrate versioning, changelog generation, and publishing of packages.

graph

Visualize the project dependency graph or task graph in an interactive browser UI.

Other commands

CommandDescription
nx add <plugin>Add an Nx plugin to the workspace
nx initInitialize Nx in an existing repository
nx listList installed plugins and available generators
nx show project <name>Show configuration and targets for a project
nx syncRun sync generators to keep the workspace consistent
nx repairRepair the workspace configuration
nx resetClear the local Nx cache
nx reportReport Nx version and environment information
nx format:writeFormat workspace files using Prettier
nx format:checkCheck that workspace files are formatted
nx watchWatch for file changes and re-run a target
nx execExecute a shell command for each project
nx connectConnect to Nx Cloud

Global flags

These flags are accepted by most Nx commands.
--verbose
boolean
Prints additional information about the commands (e.g., stack traces). Also enabled by setting NX_VERBOSE_LOGGING=true.
--version
boolean
Print the current version of Nx and exit.
--help
boolean
Show help for the command and exit.

Environment variables

VariableDescription
NX_VERBOSE_LOGGINGSet to true to enable verbose logging globally
NX_PARALLELDefault number of parallel tasks (overridden by --parallel)
NX_DEFAULT_OUTPUT_STYLEDefault output style for task runs
NX_INTERACTIVESet to false to disable interactive prompts in generators
NX_DRY_RUNSet to true to enable dry-run mode for generators
NX_TUISet to true or false to force-enable or force-disable the Terminal UI
NX_TUI_AUTO_EXITControls automatic TUI exit behavior after tasks finish