Skip to main content
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.

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.
Both approaches use the same tag-based constraint system.

Step 1: Tag your projects

Add tags to each project’s configuration. Tags are arbitrary strings — a common convention is to use prefixes like scope: or type:.

Step 2: Configure boundary rules

Install the plugin:
Configure the rule in eslint.config.mjs:
With these rules in place:
  • scope:shared can only depend on other scope:shared projects
  • scope:admin can depend on scope:admin and scope:shared
  • scope:client can depend on scope:client and scope:shared
  • scope:client and scope:admin cannot depend on each other
Violations produce a lint error:

Tag format reference

Allow any project to depend on any other project:
Glob supports * 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.