Domain Manifest Spec

1. File Location

<configured-domains-path>/[<group>/]<domain>/<configured-manifest-file>

Boundra recursively discovers the configured manifest filename below paths.domains. The manifest's parent directory becomes the physical domain root, while name is the stable logical identity.

2. Purpose

domain.json is the source of truth for a domain's public API and declared domain dependencies.

It is used by:

  • check-boundaries
  • graph-domains
  • generate route|query|mutation
  • add-dependency
  • BR-004 public API validation
  • BR-006 declared dependency validation

3. Schema Shape

{
  "$schema": "https://boundra.dev/schemas/domain-manifest.v1.json",
  "name": "billing",
  "version": "0.1.0",
  "publicApi": {
    "client": ["./client/public.ts"],
    "server": ["./server/public.ts"],
    "shared": [
      "./shared/public.ts",
      "./shared/contracts/create-invoice.ts"
    ]
  },
  "dependsOn": ["order"],
  "policies": {
    "allowCrossDomainServerImport": false,
    "allowMcpWrite": false
  }
}

4. Currently Loaded Fields

The current CLI loads and validates:

  • name
  • publicApi.client
  • publicApi.server
  • publicApi.shared
  • dependsOn

Other fields may be present and are preserved when possible, but they are not enforced yet.

5. Validation Rules

  • name must match the domain folder name.
  • duplicate name values across different roots are invalid.
  • dependsOn entries must reference existing domains.
  • dependsOn must form an acyclic graph.
  • public API paths must be relative.
  • public API paths must point to existing files.
  • public API paths must not expose internal paths.
  • directories without the configured manifest file are organizational only and are not loaded as domains.

6. Code Generation Behavior

generate route|query|mutation <domain>/<name> creates a shared contract file:

domains/<domain>/shared/contracts/<name>.ts

After generation, the CLI appends the contract to:

{
  "publicApi": {
    "shared": ["./shared/contracts/<name>.ts"]
  }
}

Existing publicApi.shared entries are preserved. Duplicate entries are not added.

Generation also appends an idempotent export to shared/public.ts.

7. Compact Single-Layer Domains

A domain with exactly one non-empty public API category may keep its direct implementation files at the domain root:

domains/comparison/
├── domain.json
├── public.ts
├── storage.ts
└── tests/
    └── storage.spec.ts
{
  "publicApi": {
    "client": ["./public.ts"],
    "server": [],
    "shared": []
  }
}

Direct root files inherit that single layer for boundary enforcement. Explicit layer directories retain their normal meaning, and nested root directories do not inherit the compact layer. Domains exposing two or more public API categories must use explicit layer directories.

8. Dependency Update Behavior

add-dependency <domain>/<dependency> appends the dependency to dependsOn. Both domains must exist, self-dependencies are rejected, and repeated calls do not add duplicates. An edge that would create a dependency cycle is rejected without changing the manifest.

9. Versioning

Initial schema version:

v1

Schema changes should be additive first. Breaking changes require an ADR.