As a monorepo grows, unrestricted dependencies between projects lead to a tangled architecture that becomes difficult to maintain. Nx provides a tag-based constraint system that lets you define and automatically enforce which projects are allowed to depend on each other.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.
Two approaches
Nx supports two complementary approaches:ESLint (JS/TS projects)
Enforces boundaries on TypeScript imports and
package.json dependencies during linting with the @nx/enforce-module-boundaries rule.Conformance (any language)
Enforces boundaries on the full Nx project graph using
nx conformance:check. Works for Java, Python, PHP, and any other project type. Requires Nx Enterprise.Step 1: Tag your projects
Addtags to each project’s configuration. Tags are arbitrary strings — a common convention is to use prefixes like scope: or type:.
- project.json
- package.json
Step 2: Configure boundary rules
- ESLint (flat config)
- ESLint (legacy .eslintrc.json)
- Conformance (nx.json)
Install the plugin:Configure the rule in
eslint.config.mjs:scope:sharedcan only depend on otherscope:sharedprojectsscope:admincan depend onscope:adminandscope:sharedscope:clientcan depend onscope:clientandscope:sharedscope:clientandscope:admincannot depend on each other
Tag format reference
Exact string match
Exact string match
Wildcard (*)
Wildcard (*)
Allow any project to depend on any other project:
Regular expression
Regular expression
Glob pattern
Glob pattern
* only. Use regex for more complex patterns.Projects without any tags cannot depend on any other projects by default. You must explicitly allow them using the
"*" wildcard, or add tags to those projects.