Boundra Config Spec

1. File Location

Root file:

boundra.config.json

The file is optional. When it is missing, Boundra uses built-in defaults.

2. Purpose

boundra.config.json defines the project model used by the CLI:

  • workspace and package roots
  • domain root and manifest file name
  • default public API paths for new domains
  • scanner extensions and ignored paths for boundary checks
  • dependency capability classification and shared-layer policy

3. Supported Fields

project

{
  "project": {
    "workspaceRoot": "."
  }
}

Supported:

  • workspaceRoot: relative workspace root path

paths

{
  "paths": {
    "apps": "apps",
    "domains": "domains",
    "packages": "packages",
    "crates": "crates"
  }
}

Supported:

  • apps
  • domains
  • packages
  • crates

All paths must be relative.

domain

{
  "domain": {
    "manifestFile": "domain.json",
    "publicApi": {
      "client": ["./client/public.ts"],
      "server": ["./server/public.ts"],
      "shared": ["./shared/public.ts"]
    }
  }
}

Supported:

  • manifestFile: file name only, not a path
  • publicApi.client
  • publicApi.server
  • publicApi.shared

These defaults are used by create-domain.

checkBoundaries

{
  "checkBoundaries": {
    "includeExtensions": ["ts", "tsx", "js", "jsx", "svelte"],
    "ignore": [
      "**/node_modules/**",
      "**/.next/**",
      "**/.turbo/**",
      "**/.claude/worktrees/**",
      "**/dist/**",
      "**/build/**",
      "**/coverage/**",
      "**/target/**"
    ],
    "capabilities": {
      "external": {
        "react": ["ui"],
        "@prisma/client": ["database"],
        "node:*": ["runtime"]
      },
      "packages": {
        "ui": ["ui"],
        "db": ["database"],
        "infra": ["runtime"]
      },
      "apps": ["runtime"]
    },
    "policy": {
      "shared": {
        "denyCapabilities": ["ui", "database", "runtime"]
      }
    }
  }
}

Supported:

  • includeExtensions: file extensions scanned by the parser
  • ignore: simple workspace-relative ignore patterns
  • capabilities.external: external import matcher to capability list
  • capabilities.packages: direct child under paths.packages to capability list
  • capabilities.apps: capabilities assigned to imports that resolve into paths.apps
  • policy.shared.denyCapabilities: capabilities that trigger BR-003 from shared

External matchers match an exact package and its subpaths. A single trailing * is supported for prefix families such as node:*.

Configured external and packages entries overlay the built-in defaults. Assigning an empty list disables that source's default classification. apps and policy.shared.denyCapabilities replace their respective defaults.

4. Defaults

When no config file is present, Boundra behaves as if the following config exists:

{
  "project": {
    "workspaceRoot": "."
  },
  "paths": {
    "apps": "apps",
    "domains": "domains",
    "packages": "packages",
    "crates": "crates"
  },
  "domain": {
    "manifestFile": "domain.json",
    "publicApi": {
      "client": ["./client/public.ts"],
      "server": ["./server/public.ts"],
      "shared": ["./shared/public.ts"]
    }
  },
  "checkBoundaries": {
    "includeExtensions": ["ts", "tsx", "js", "jsx", "svelte"],
    "ignore": [
      "**/node_modules/**",
      "**/.next/**",
      "**/.turbo/**",
      "**/.claude/worktrees/**",
      "**/dist/**",
      "**/build/**",
      "**/coverage/**",
      "**/target/**"
    ],
    "capabilities": {
      "external": {
        "react": ["ui"],
        "react-dom": ["ui"],
        "next": ["ui", "runtime"],
        "@prisma/client": ["database"],
        "fs": ["runtime"],
        "path": ["runtime"],
        "crypto": ["runtime"],
        "child_process": ["runtime"],
        "stream": ["runtime"],
        "http": ["runtime"],
        "https": ["runtime"],
        "os": ["runtime"],
        "process": ["runtime"],
        "node:*": ["runtime"]
      },
      "packages": {
        "ui": ["ui"],
        "db": ["database"],
        "infra": ["runtime"]
      },
      "apps": ["runtime"]
    },
    "policy": {
      "shared": {
        "denyCapabilities": ["ui", "database", "runtime"]
      }
    }
  }
}

5. Validation Rules

  • configured paths must be relative
  • paths.domains must exist for project model loading
  • domain.manifestFile must be a file name
  • public API paths must be relative
  • public API paths must not expose internal
  • checkBoundaries.includeExtensions must not be empty
  • capability names must not be empty
  • external capability wildcards must be a single trailing *
  • workspace capability package keys must be direct child names under paths.packages

6. Workspace Import Aliases

When a root tsconfig.json exists, Boundra reads compilerOptions.paths for boundary resolution. Relative extends chains are resolved from parent to child, and child aliases override aliases with the same pattern. Alias targets respect the baseUrl of the config that declares them.

When a root package.json exists, Boundra also reads local string mappings from the standard imports field. Exact mappings such as "#billing": "./domains/billing/shared/public.ts" and single-wildcard patterns such as "#domain/*": "./domains/*/shared/public.ts" resolve into workspace paths before BR-001 through BR-006 run. Targets must start with ./ and remain inside the workspace. Conditional objects and arrays are left to the Node.js runtime and are not resolved by the current static analyzer.

Each file is parsed as JSONC, including comments and trailing commas, to match normal TypeScript configuration syntax. Package-based extends values are ignored until Boundra defines package resolution semantics.

Only compilerOptions.paths affects the Boundra project model. Other TypeScript compiler options remain owned by the TypeScript toolchain.

Alias resolution validates architectural boundaries, not deployment artifact tracing. An alias that points directly at raw TypeScript can still require bundler or platform include configuration. Prefer a workspace package or a runtime-resolvable built entrypoint for server code, and keep a deployment smoke test for the produced artifact.

7. Not Yet Supported

The following fields are planned or possible later, but are not implemented in the current CLI:

  • version
  • naming
  • rules
  • codegen
  • graph
  • custom exit codes
  • custom diagnostic messages

8. Conformance and Drift Protection

The native Rust loader and the public boundra/config TypeScript surface must represent the same supported configuration contract.

The repository keeps one full representative config fixture at fixtures/config-conformance/boundra.config.json. Rust integration tests load that fixture through the real native config loader, while the TypeScript config tests consume the same fixture through the public authoring helper.

In addition, pnpm check-config-drift compares the Rust Raw*Config field tree with the TypeScript BoundraConfig interface tree. The check compares supported field paths and their normalized leaf kinds (string, string[], and record<string, string[]>). CI fails when either side adds, removes, renames, or changes the shape of a supported field without updating the other side.

This check protects the public authoring API from claiming support that the CLI does not implement, and protects the native CLI from adding configuration that TypeScript users cannot author through boundra/config.