The Nx CLI provides many commands. They are organized here into commands that:
There is also a section for separate commands that can create a new Nx workspace for you.
Modify Code
Section titled “Modify Code”These commands modify your codebase in some way.
nx init
Section titled “nx init”Adds Nx to any type of workspace. It installs nx, creates an nx.json
configuration file and optionally sets up remote caching.
nx init
nx add
Section titled “nx add”Install a plugin and initialize it.
nx add my-plugin
nx generate
Section titled “nx generate”Runs a generator that creates and/or modifies files based on a generator from a plugin.
nx generate @nx/react:component libs/my-lib/src/lib/my-component
nx migrate
Section titled “nx migrate”Creates a migrations file or runs migrations from the migrations file.
nx migrate latestnx migrate --run-migrations
nx import
Section titled “nx import”Import code and git history from another repository into this repository.
nx import https://github.com/myorg/inventory-app.git apps/inventorynx import ../inventory-app apps/inventory
nx repair
Section titled “nx repair”Repair any configuration that is no longer supported by Nx.
Specifically, this will run every migration within the nx package against the current repository. Doing so should fix any configuration details left behind if the repository was previously updated to a new Nx version without using nx migrate.
If your repository has only ever updated to newer versions of Nx with nx migrate, running nx repair should do nothing.
nx repair
nx sync
Section titled “nx sync”Run all sync generators
nx syncnx sync:check
nx format
Section titled “nx format”Overwrite un-formatted files or check for un-formatted files
nx formatnx format:check
Run Tasks
Section titled “Run Tasks”These commands run tasks on your code.
nx run
Section titled “nx run”Run a target for a project
nx run my-app:buildnx build my-app
nx run-many
Section titled “nx run-many”Run target for multiple listed projects
nx run-many --target=build
nx affected
Section titled “nx affected”Run target for affected projects
nx affected --target=build
nx exec
Section titled “nx exec”Executes any command as if it was a target on the project
{ "scripts": { "build": "nx exec -- node ./my-custom-build.js" }}
nx watch
Section titled “nx watch”Watch for changes within projects, and execute commands
nx watch --projects=assets -- nx build assets
nx release
Section titled “nx release”Orchestrate versioning and publishing of applications and libraries
nx release versionnx release changelognx release publish
nx reset
Section titled “nx reset”Clears cached Nx artifacts and metadata about the workspace and shuts down the Nx Daemon.
nx reset
Display Information
Section titled “Display Information”nx show
Section titled “nx show”Show information about the workspace (e.g., list of projects)
nx show projectsnx show project my-app
nx graph
Section titled “nx graph”Graph dependencies within workspace
nx graph
nx list
Section titled “nx list”Lists installed plugins, capabilities of installed plugins and other available plugins.
nx listnx list my-plugin
nx report
Section titled “nx report”Reports useful version numbers to copy into the Nx issue template
nx report
nx daemon
Section titled “nx daemon”Prints information about the Nx Daemon process or starts a daemon process
nx daemon
nx mcp
Section titled “nx mcp”Starts the Nx MCP server for exposing Nx tools to various AI systems (VSCode, Cursor, Claude, ...)
Integrate with Nx Cloud
Section titled “Integrate with Nx Cloud”nx connect
Section titled “nx connect”Connect an Nx workspace to Nx Cloud
nx connect
nx login
Section titled “nx login”Login to Nx Cloud. This command is an alias for nx-cloud login
.
nx login
nx logout
Section titled “nx logout”Logout from Nx Cloud. This command is an alias for nx-cloud logout
.
nx logout
nx record
Section titled “nx record”Records command execution for distributed task execution. This command is an alias for nx-cloud record
.
nx record -- nx run my-app:build
nx start-ci-run
Section titled “nx start-ci-run”Starts a new CI run for distributed task execution. This command is an alias for nx-cloud start-ci-run
.
nx start-ci-run
nx fix-ci
Section titled “nx fix-ci”Fixes CI failures with AI-powered suggestions. This command is an alias for nx-cloud fix-ci
.
nx fix-ci
Create Commands
Section titled “Create Commands”create-nx-workspace
Section titled “create-nx-workspace”Create a new Nx workspace
npx create-nx-workspace@latest
create-nx-plugin
Section titled “create-nx-plugin”Create a new Nx workspace with a preset designed for writing an Nx plugin
npx create-nx-plugin@latest