<a id="adopt-one-package-at-a-time"></a>

# Adopt One Package at a Time

You do not need to scaffold a new repository to use Dads. Every framework capability ships as a standalone npm package you can install inside an existing Express, Fastify, Hono, Next.js, or Node.js TypeScript project.

<a id="1-add-postgres-rebac-to-an-existing-app"></a>

## 1\. Add Postgres ReBAC to an existing app

If you already run PostgreSQL and want Zanzibar-style relationship permissions without operating a second database or an authorization outbox, install `@dads-framework/access` and `@dads-framework/postgres-access`:

```sh
npm install @dads-framework/access @dads-framework/postgres @dads-framework/postgres-access zod
```

1.  Declare entities, roles, and permissions in TypeScript with `entityHandle`, `access`, and `accessModel`.
2.  Apply `relationshipSchemaMigration.sql` through your existing migration runner.
3.  Instantiate `PostgresAuthorization` with your `pg.Pool` and run `check`, `lookupResources`, or `withProtectedPostgresTransaction`.

See [Permissions in Postgres & SpiceDB](https://dadsframework.dev/docs/permissions) for the complete walkthrough, or the [`@dads-framework/postgres-access`](https://dadsframework.dev/docs/package-postgres-access) package page for a standalone runnable script.

<a id="2-replace-hand-written-spicedb-zed-files"></a>

## 2\. Replace hand-written SpiceDB `.zed` files

If your team already operates SpiceDB and wants compile-time checking instead of raw `.zed` files and string permission names, install `@dads-framework/access` alone (zero database dependencies):

```sh
npm install @dads-framework/access zod
```

Author your model in TypeScript, emit `.zed` with `emitZed(model)`, and compare your committed schema file against `emitZed(model)` in CI. See [`@dads-framework/access`](https://dadsframework.dev/docs/package-access) for a runnable schema-generation script, and [`@dads-framework/authorization`](https://dadsframework.dev/docs/package-authorization) when you also want a typed SpiceDB runtime client bound to the same model.

<a id="3-add-fail-closed-http-routes-and-openapi-31"></a>

## 3\. Add fail-closed HTTP routes and OpenAPI 3.1

Install [`@dads-framework/http`](https://dadsframework.dev/docs/package-http) and [`@dads-framework/contract`](https://dadsframework.dev/docs/package-contract) to declare Fastify routes where every verb requires an explicit `access` rule, rejects unauthorized requests before input validation, and generates OpenAPI 3.1 directly from Zod schemas:

```sh
npm install @dads-framework/http @dads-framework/contract zod
```

Read [Routes, Contracts & Clients](https://dadsframework.dev/docs/routes-and-contracts) to wire your first route group.

<a id="4-add-boundary-checks-and-doctor-to-any-typescript-repo"></a>

## 4\. Add boundary checks and Doctor to any TypeScript repo

The Dads CLI can inspect an existing repository without rewriting your folder layout:

```sh
npx @dads-framework/toolbox doctor
```

To add an isolated Dads workspace beside an existing codebase, run:

```sh
npm create dads@latest . -- --existing
```

This writes the starter inside a `dads/` subdirectory and leaves your existing files untouched.

<a id="standalone-package-catalog"></a>

## Standalone package catalog

| Capability | Packages |
| :-- | :-- |
| Relationship permission model and `.zed` emitter | [`@dads-framework/access`](https://dadsframework.dev/docs/package-access) |
| Transactional PostgreSQL ReBAC engine | [`@dads-framework/postgres-access`](https://dadsframework.dev/docs/package-postgres-access) |
| SpiceDB runtime client and outbox | [`@dads-framework/authorization`](https://dadsframework.dev/docs/package-authorization) |
| Typed HTTP routes, guards, and OpenAPI 3.1 | [`@dads-framework/http`](https://dadsframework.dev/docs/package-http), [`@dads-framework/contract`](https://dadsframework.dev/docs/package-contract) |
| Auth, sessions, workspaces, SSO, and SCIM | [`@dads-framework/identity`](https://dadsframework.dev/docs/package-identity), [`@dads-framework/tenants`](https://dadsframework.dev/docs/package-tenants) |
| Audit trail, feature flags, jobs, storage, PDF, CSV | [Browse all packages](https://dadsframework.dev/docs/packages) |

Canonical page: <https://dadsframework.dev/docs/adopt-standalone>
