A project’s configuration in Nx is assembled from three sources, each overriding the previous: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.
- Tasks inferred by Nx plugins from tooling configuration files
- Workspace
targetDefaultsinnx.json - Project-level configuration in
project.jsonorpackage.json
packages/nx/schemas/project-schema.json.
Configuration files
Nx mergesproject.json and the "nx" property in package.json to produce each project’s final configuration. Both support identical configuration options, including executors.
- project.json
- package.json
project.json
Project metadata fields
name
The project’s identifier used in Nx commands, e.g.
nx build mylib. Optional
if the project is discovered via package.json "name" field.root
Path to the project directory relative to the workspace root. Nx uses this
to scope file inputs and resolve paths.
sourceRoot
Path to the project’s source files relative to the workspace root. Used by
some executors and lint rules.
projectType
Classifies the project.
"application" projects are deployable artifacts;
"library" projects are reusable code consumed by other projects.tags
Labels attached to the project. Used by module boundary lint rules to enforce
dependency constraints across teams or domains.
project.json
implicitDependencies
Manually declare dependencies that Nx cannot detect from source code. Prefix
a project name with
! to explicitly remove a dependency. Glob patterns are
supported.project.json
namedInputs
Project-level named input definitions. These override workspace-level named
inputs of the same name for this project’s tasks only.
project.json
metadata
A human-readable description of the project, visible in the project graph UI.
project.json
targets
Targets define the tasks you can run against a project. Each key intargets becomes a runnable command: nx <target> <project>.
project.json
executor
The Nx executor that runs this target, in
"<plugin>:<executor>" format. Use
"nx:run-commands" to run an arbitrary shell command. Omit this field when
using the command shorthand.command
Shorthand for running a shell command via
nx:run-commands. Equivalent to
setting executor: "nx:run-commands" and options.command.project.json
options
Default options passed to the executor or command. The available properties
depend on the executor being used.
configurations
Named sets of option overrides. Activate a configuration with
nx build mylib --configuration=production.project.json
defaultConfiguration
The configuration name used when no
--configuration flag is supplied.cache
Whether Nx should cache task results. Set to
true to enable caching for a
target (required as of Nx 17).project.json
inputs
File sets, environment variables, and other inputs used to compute the cache
hash. If any input changes, the task re-runs. Accepts named input strings and
input objects.
project.json
outputs
Paths where the target writes file artifacts. Nx caches and restores these
paths. Supports
{projectRoot} and {workspaceRoot} tokens, glob patterns,
and negation patterns.project.json
outputs are specified:
{workspaceRoot}/dist/{projectRoot}{projectRoot}/build{projectRoot}/dist{projectRoot}/public
dependsOn
Tasks that must complete before this target starts. Use string shorthand or
the object form for advanced control.
| Shorthand | Meaning |
|---|---|
"^build" | Run build on all project dependencies first |
"build" | Run build on the current project first |
"build-*" | Run all targets matching the pattern on the current project first |
"^build-*" | Run all matching targets on all dependencies first |
- String shorthand
- Object form
- Specific projects
project.json
continuous
Mark this target as a long-running process that never exits (e.g. a dev
server). Dependent tasks start without waiting for this target to finish.
Available in Nx 21+.
project.json
parallelism
Whether this target may 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. Available in Nx 19.5+.project.json
parallelism: false only prevents concurrent execution on a single machine.
With Nx Agents, the same target can still run on multiple agents simultaneously
because agents do not share resources.syncGenerators
Sync generators to run before this target executes to ensure configuration
files are up to date. Available in Nx 19.8+.
project.json
metadata
A human-readable description of what this target does, visible in
nx show project output.project.json
How target configuration is merged
Nx builds a target’s effective configuration in this order, with later sources overriding earlier ones:Inferred tasks
Nx plugins inspect tooling config files (e.g.
vite.config.ts,
jest.config.ts) and infer task definitions automatically.targetDefaults in nx.json
Workspace-wide defaults keyed by executor or target name are merged on top
of inferred tasks. Only one matching default is applied per target.
package.json integration
Nx automatically includes anypackage.json referenced by your package manager’s workspace configuration. Scripts defined in scripts become Nx targets.
Limiting which scripts become targets
UseincludedScripts to opt in to specific scripts as Nx targets, ignoring the rest:
package.json
