- 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
string
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
string
required
Path to the project directory relative to the workspace root. Nx uses this
to scope file inputs and resolve paths.
sourceRoot
string
Path to the project’s source files relative to the workspace root. Used by
some executors and lint rules.
projectType
"application" | "library"
Classifies the project.
"application" projects are deployable artifacts;
"library" projects are reusable code consumed by other projects.tags
string[]
Labels attached to the project. Used by module boundary lint rules to enforce
dependency constraints across teams or domains.
project.json
implicitDependencies
string[]
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
object
Project-level named input definitions. These override workspace-level named
inputs of the same name for this project’s tasks only.
project.json
metadata
string
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
string
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
string
Shorthand for running a shell command via
nx:run-commands. Equivalent to
setting executor: "nx:run-commands" and options.command.project.json
options
object
Default options passed to the executor or command. The available properties
depend on the executor being used.
configurations
object
Named sets of option overrides. Activate a configuration with
nx build mylib --configuration=production.project.json
defaultConfiguration
string
The configuration name used when no
--configuration flag is supplied.cache
boolean
Whether Nx should cache task results. Set to
true to enable caching for a
target (required as of Nx 17).project.json
inputs
array
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
string[]
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
array
Tasks that must complete before this target starts. Use string shorthand or
the object form for advanced control.
- String shorthand
- Object form
- Specific projects
project.json
continuous
boolean
default:"false"
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
boolean
default:"true"
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
string[]
Sync generators to run before this target executes to ensure configuration
files are up to date. Available in Nx 19.8+.
project.json
metadata
string
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:1
Inferred tasks
Nx plugins inspect tooling config files (e.g.
vite.config.ts,
jest.config.ts) and infer task definitions automatically.2
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.
3
Project-level configuration
Settings in
project.json or package.json override both inferred tasks
and targetDefaults.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
