TheDocumentation 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.
nx.json file configures the Nx CLI and workspace-wide project defaults. It lives at the root of your workspace. The full machine-readable schema is available at packages/nx/schemas/nx-schema.json.
Below is an expanded example showing all common options. Your actual nx.json will be much shorter.
nx.json
Top-level task options
The following properties control how Nx runs tasks.Maximum number of tasks Nx runs in parallel. Defaults to
3. Can also be
overridden per-invocation with --parallel=<n>.Directory where the local task output cache is stored. Defaults to
.nx/cache. Override with the NX_CACHE_DIRECTORY environment variable.The base branch used by
nx affected to determine which projects changed.
Defaults to "main". Override with the NX_BASE environment variable or
--base flag.The project used when no project is specified on the command line, e.g. bare
nx build. Override with the NX_DEFAULT_PROJECT environment variable.Whether to use the Nx daemon for computing the project graph. Defaults to
true. Disable with NX_DAEMON=false.Specifies a base configuration file to extend. Nx preset files live in
node_modules/nx/presets/, e.g. "nx/presets/npm.json".Maximum size of the local task cache. Accepts bytes or unit suffixes:
"819200", "100MB", "1GB", or "0" to disable the limit. When the cache
exceeds this size, Nx evicts the least-recently-used entries. Defaults to 10%
of disk size, up to 10 GB. Override with NX_MAX_CACHE_SIZE.Plugins
Nx plugins extend the project graph and can automatically infer tasks from tooling configuration files. Register a plugin in theplugins array. Plugins with no options can be a plain string; plugins with options must be an object.
nx.json
The npm package or local path of the plugin module to load.
Plugin-specific options passed when the plugin creates nodes and dependencies.
Consult each plugin’s documentation for available options.
Glob patterns for configuration files the plugin should process. Only projects
whose config file path matches will have tasks inferred by this plugin.
Glob patterns for configuration files the plugin should ignore. Supports
negation patterns (prefixed with
!). Patterns are applied in order.Scoping plugins to specific projects
Useinclude and exclude to control which projects a plugin processes.
nx.json
namedInputs
Named inputs are reusable input definitions that can be referenced by name intargetDefaults and individual target configurations. They are defined as a map of name to input array.
nx.json
nx.json apply to all projects. Projects can override them in their own project.json or package.json.
Inputs reference
Full documentation of all input types: filesets, env vars, runtime commands,
external dependencies, and more.
Task caching guide
Walkthrough of common caching configurations and how to tune inputs.
targetDefaults
Target defaults provide workspace-wide configuration that is applied to any target whose name or executor matches the key. Project-level configuration always takes precedence over target defaults. Nx resolves a target default by checking, in order:- A key matching the target’s executor (e.g.
"@nx/js:tsc") - A key matching the target name (e.g.
"build"), provided the executor also matches if one is configured in the default - A glob key matching the target name (e.g.
"e2e-ci--**/**")
Supported target default properties
The executor to invoke when this target runs.
Default options merged into every matching target’s options. Use
{projectRoot} and {workspaceRoot} tokens for path values.Named configuration overrides merged into the target’s
configurations map.The configuration name used when none is specified on the command line.
Overrides the
inputs used to compute the cache hash for every matching
target. Accepts named inputs, file globs, and input objects.Paths (relative to workspace root) where the target writes artifacts that
should be cached. Supports
{projectRoot} and {workspaceRoot} tokens.Tasks that must complete before this target runs. Use
"^build" to mean
“build all dependencies first”.Whether Nx should cache the results of this target. Set to
true to enable
caching (required in Nx 17+).Mark a target as long-running (never exits). Dependent tasks will start
without waiting for this target to finish.
Whether this target can run in parallel with other targets on the same
machine. Set to
false for targets that require exclusive access to a shared
resource such as a port.Sync generators to run before this target executes to ensure the workspace is
in a consistent state.
Examples
Build dependency ordering
Build dependency ordering
Ensure dependencies are built before the current project:
nx.json
Executor-specific options
Executor-specific options
Apply default options only to targets using a specific executor:
nx.json
Task atomizer glob key
Task atomizer glob key
Apply options to all targets generated by an atomizer plugin:
nx.json
workspaceLayout
Controls the default directories suggested when generating new applications and libraries.nx.json
Default directory for new applications generated by
nx g.Default directory for new libraries generated by
nx g.generators
Set default option values for code generators so you don’t have to pass them every time.nx.json
"<collection>:<generator>" and the value is an object of default option values.
release
Configures thenx release command, which orchestrates versioning, changelog generation, and publishing. All properties are optional — nx release works with zero config.
nx.json
release.projects
Projects included in
nx release. Accepts project names, glob patterns,
directory paths, and tag references. Defaults to all projects.release.projectsRelationship
Whether projects are released together at the same version (
"fixed") or
each at their own version ("independent").release.version
Derive the next version from commit messages following the Conventional
Commits specification.
How to determine the version bump.
"prompt" asks interactively;
"conventional-commits" reads commit messages; "version-plans" reads
version plan files on disk.A shell command to run after configuration validation but before versioning
begins. Useful for building artifacts. Runs even during
--dry-run with
NX_DRY_RUN=true set.Ecosystem-specific options passed to the version actions implementation (e.g.
{ "skipLockFileUpdate": true } for @nx/js).release.changelog
Configure the workspace-level
CHANGELOG.md. Set to false to disable.
When an object, supports createRelease: "github" to create a GitHub
release, file: false to skip writing the file, and
replaceExistingContents: true to overwrite rather than prepend.Configure per-project
CHANGELOG.md files. Set to true for defaults or
provide an object with the same options as workspaceChangelog.release.releaseTag
In Nx 22+, release tag settings use the nested
releaseTag object. The older
flat properties (releaseTagPattern, etc.) are deprecated and will be removed
in Nx 23.Git tag pattern. Supports
{version}, {projectName}, and
{releaseGroupName} interpolation. Defaults to "v{version}" for fixed
releases and "{projectName}@{version}" for independent releases.Require all tags to be valid semantic versions.
Ensure pre-release IDs are consistent across packages.
Controls whether Nx searches all branches for the latest matching tag.
true always checks all branches; false only checks the current branch;
an array of branch name patterns checks all branches only when on a matching
branch.release.git
Automatically commit version bumps and changelog changes.
Custom commit message. Defaults to
"chore(release): publish".Automatically create a git tag after releasing.
Automatically push commits and tags to the remote.
sync
Configuration fornx sync, which runs sync generators to keep workspace files consistent before tasks execute.
nx.json
Sync generators run only when
nx sync is called directly. Not associated
with a specific task.Options keyed by generator name, passed to sync generators at runtime.
When
true, sync generator changes are applied automatically before tasks
run. When false, changes are skipped. When unset, Nx prompts interactively.Globally disable specific task-attached sync generators.
Nx Cloud
Connect your workspace to Nx Cloud for remote caching and distributed task execution.nx.json
Your Nx Cloud workspace ID. Generated when you connect via
nx connect.URL of your Nx Cloud instance. Defaults to
https://cloud.nx.app. Set for
self-hosted deployments.Encryption key for end-to-end encryption of cached artifacts. Also
configurable via
NX_CLOUD_ENCRYPTION_KEY.tui
Configuration for the Nx Terminal UI (TUI), which provides an interactive visual interface when running tasks.nx.json
Enable the TUI when the terminal supports it. Override with
NX_TUI=false.Controls automatic exit after all tasks complete.
true exits immediately;
false keeps the TUI open; a number shows a countdown for that many seconds.
Override with NX_TUI_AUTO_EXIT.Suppress hint popups that appear for unhandled key presses.
