Architecture tooling for TypeScript
Keep domain boundaries intact.
Catch invalid imports before they merge. Validate the contracts between your domains, without replacing your existing stack.
Boundra checks imports against layer rules, public entry points and the dependency manifest before a change merges.
Rust-powered CLI · TypeScript runtime · Node.js 20+
import { orderService } from
"@domains/order/server/internal";"dependsOn": []BR-001BR-001PASSSeparate client and server code by moving contracts into shared.
Start with two domains.
Keep your existing project. Declare one dependency, then run the checker.
Install and check
The npm package includes a launcher for the native CLI. It downloads and verifies the matching platform binary on first use.
pnpm add boundra zod
pnpm exec boundra init --name my-app
pnpm exec boundra create-domain order
pnpm exec boundra create-domain billing
pnpm exec boundra add-dependency billing/order
pnpm exec boundra check-boundariesDeclare the structure
The CLI generates a manifest and layer directories. Billing can use order's public API because the dependency is declared.
domains/
order/
client/
server/
shared/
public.ts
billing/
client/
server/
shared/One contract. Both ends.
Define the shape of a request and its result once. Boundra validates both ends of a call using your schemas.
Keep your existing backend and routing. Connect the runtime to a local transport or your own HTTP adapter.
Walk through a working contractimport { defineQuery } from "boundra";
import { z } from "zod";
export const getOrderQuery = defineQuery({
name: "get-order",
input: z.object({ orderId: z.string().min(1) }),
result: z.object({ orderId: z.string(), status: z.string() }),
});Make the boundary part of CI.
Add a boundary check to your CI. The CLI produces machine-readable violations and returns a nonzero exit code when checks fail. Keep your typecheck and tests, and require meaningful scan coverage.
CI configuration and exit codespnpm exec boundra check-boundaries --format jsonDocumentation
Read the full guides and API references on this site.
Getting started
Install Boundra and create your first domains.
Order and billing example
This repository example demonstrates two domains, a declared dependency, a query, mutation and route, and input validation. The order domain owns its contracts. Billing depends on order.
Boundary rules
Understand BR-001 through BR-006, public APIs and dependencies.
Contracts
Define queries, mutations and routes, then connect your transport.
Framework integration
Use Boundra alongside Vite or Next.js.
Configuration
Configure domain discovery, paths, aliases and capabilities.
Continuous integration
Run the checker before merge and require meaningful scan coverage.
Adopt it where boundaries matter.
Use it when domain APIs and dependency directions need to be explicit. It does not replace authorization, routing, persistence, a bundler, or application tests.
Compare adoption options and limitations