Your agents don't care about boundaries. **Dad does.**

# One TypeScript framework for your entire backend.

Typed HTTP contracts, Zanzibar permissions in Postgres, auth, SSO, SCIM, and audit logs out of the box. Routes won't compile without an access rule.

[Read the docs](https://dadsframework.dev/docs/) [Browse all packages](https://dadsframework.dev/docs/packages)

<a id="feature-preview-title"></a>

## Start a project

```sh
npm create dads@latest my-app -- --template minimal
```

*   `my-app/`
*   `apps/` Entrypoints that expose routes
*   `customer/app.ts` Public API for your users
*   `staff/app.ts` Internal API for your team
*   `domains/` Your isolated features
*   `tenants/` Built-in auth, users & workspaces
*   `assembly/` Server startup, Postgres & env
*   `dads.project.json` Import rules enforced in CI

Batteries included

*   Postgres ReBAC
*   Auth & SSO
*   SCIM
*   OpenAPI 3.1
*   Audit Log
*   Migrations
*   Feature Flags
*   Job Queue
*   Object Storage
*   Email
*   PDF & CSV
*   React UI

Full backend shape, zero demo code. Add your first resource with `npx dad add resource`.

Relationship permissions in Postgres

<a id="rebac-heading"></a>

## Zanzibar-style access, compiled into your Postgres transactions.

Define who can access what as a typed relationship graph in TypeScript. Kick a member out of a workspace and every child resource (tasks, notes, attachments, activity) locks down in the same PostgreSQL transaction as the write.

*   **Not hand-rolled `if (user.role)`** Declare inheritance once with `through(...)`. Routes cannot compile without an `access` rule, and denials fail closed with `404` before parsing input.
*   **Not brittle Postgres RLS strings** Plain TypeScript models with full type checking, in-memory fakes for unit tests, and zero SQL policy sprawl.
*   **No second database or outbox lag** Compiles directly to indexed PostgreSQL SQL with sub-ms warm point checks. Outgrow Postgres later and the exact same model emits Zed for SpiceDB.

domains/tasks/access/index.ts

```ts
import { access, entityHandle, through } from "@dads-framework/access";
import { userId, workspaceId } from "../../../libraries/app-runtime/index.js";
import { taskId } from "../contract/wire.js";

const user = entityHandle({ wireName: "user", idSchema: userId });
const workspaceEntity = entityHandle({
  wireName: "workspace",
  idSchema: workspaceId,
  kind: "scope",
});
const taskEntity = entityHandle({ wireName: "task", idSchema: taskId });

export const workspace = access(workspaceEntity, {
  roles: { owner: user, member: user },
  permissions: ({ owner, member }) => ({
    view: [owner, member],
    manage: [owner],
  }),
});

// Tasks inherit access from their workspace automatically.
export const task = access(taskEntity, {
  roles: { workspace: workspaceEntity },
  permissions: ({ workspace: parent }) => ({
    view: [through(parent, workspace.permissions.view)],
    manage: [through(parent, workspace.permissions.manage)],
  }),
});

export const canManageTasks = workspace.permissions.manage;
```

Explicit API composition

<a id="multi-api-heading"></a>

## Separate entrypoints, shared domains.

Select which routes and background jobs each API exposes in plain TypeScript with `composeApi`. Both surfaces share the same domain packages without sharing an attack surface.

*   **Customer API mounts product routes** Mounts tenant auth, permissions, notes, and background workers behind workspace ReBAC checks.
*   **Staff API omits them at the router** Mounts internal audit exports only. Customer routes aren't guarded by a flag; they don't exist on the process.

## Customer API

[apps/customer/app.ts](https://github.com/brytoncooper/dads-framework/blob/main/apps/kit-workbench/apps/customer/app.ts)

```ts
return composeApi("customer", {
  services: [provider, starterAccess],
  routes: [
    tenantsPlugin,
    tenantPermissionsPlugin,
    notesPlugin,
    // dad:add domains
  ],
  jobs: [notesAttachmentWorker],
});
```

## Staff API

[apps/staff/app.ts](https://github.com/brytoncooper/dads-framework/blob/main/apps/kit-workbench/apps/staff/app.ts)

```ts
return composeApi("staff", {
  services: [provider, starterAccess],
  routes: [
    tenantsPlugin,
    tenantAuditExportPlugin,
    // dad:add domains
  ],
  jobs: [],
});
```

GET `/api/tenants/:tenantId/notes`

| API | Workspace access | Response |
| --- | --- | --- |
| Customer | Member | 200 OK |
| Customer | Revoked | 404 Not Found |
| Staff | Any | 404 Not Found |

Mechanical enforcement

<a id="boundaries-heading"></a>

## Rules checked by tools, not reviewer memory.

Whether a teammate or a coding agent opens the PR, Dads enforces repo structure, type discipline, and denial tests automatically.

*   **Domain boundaries in CI** `npx dad check boundaries` blocks domains from importing another domain's tables or private modules.
*   **Zero-drift doctor gate** `npx dad doctor --gate` catches `any`, unsafe casts, unguarded routes, and missing denial tests.
*   **Adopt one package at a time** Not starting from scratch? Every package, from `@dads-framework/postgres-access` to `@dads-framework/http`, installs standalone.

npx dad verify CI gate

```
$ npx dad check boundaries
FAIL domains/billing/server/routes.ts
     imports private module domains/shipping/server/tables.ts
     Fix: pass a typed port from assembly/ instead of crossing domains.

$ npx dad doctor --gate
PASS explicit-any             0 over (Dad: 0)
PASS routes-without-access    0 over (Dad: 0)
PASS access-without-denial    0 over (Dad: 0)
PASS boundaries               0 violations
```

## Keep reading

[DocumentationGuides](https://dadsframework.dev/docs/) [Adopt one package in any TypeScript appPackages](https://dadsframework.dev/docs/packages) [Your friends approved the PRRead DAD.md](https://github.com/brytoncooper/dads-framework/blob/main/DAD.md) [Who let Gary back in?Why permissions live in Postgres](https://github.com/brytoncooper/dads-framework/blob/main/docs/go-ask-your-other-database.md)

Canonical page: <https://dadsframework.dev/>
