Skip to content

Commit

Permalink
docs(nx): πŸ“ add diagram for multi-dimensional constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
yjaaidi committed May 31, 2024
1 parent 8867b58 commit 0f7e2c3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions apps/cookbook/docs/nx/03-scaling/03-boundaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,26 @@ To put this differently, the `type:domain` category has different rules dependin

Luckily, the `@nx/enforce-module-boundaries` rule supports multi-dimensional constraints that you can define using the `allSourceTags` option, and this is how you can define the previous example:

```mermaid
graph TD
web-domain[platform:web,type:domain] --βœ…--> infra[type:infra]
server-domain[platform:server,type:domain] --βœ…--> ports[type:ports]
server-domain --❌--> infra[type:infra]
```

```json
"depConstraints": [
{
"allSourceTags": ["platform:frontend", "type:domain"],
"allSourceTags": ["platform:web", "type:domain"],
"onlyDependOnLibsWithTags": ["type:domain", "type:infra"]
},
{
"allSourceTags": ["platform:backend", "type:domain"],
"allSourceTags": ["platform:server", "type:domain"],
"onlyDependOnLibsWithTags": ["type:domain", "type:ports"]
}
],
```

:::note
The diagram above is simplified for the sake of clarity.
:::

0 comments on commit 0f7e2c3

Please sign in to comment.