<!-- source: openspec/current/db/README.md -->

---
title: DB — Overview
status: stable
owner: pavel
audience: [pavel, ai, engineer]
tldr: Routing surface for the db capability — thin Supabase client wrappers (browser singleton, admin factory) plus a typed Database shape.
---
# DB — overview

> Part of openspec/current/db/ — split from db.md on 2026-05-12

Thin Supabase client wrappers (browser singleton + admin factory) plus a typed `Database` shape. Consumed by `@rapoport-studio/auth` (type-only) today; reached transitively by both apps via auth.

## Files in this capability

| File | What's inside | Read when |
|---|---|---|
| `narrative.md` | Architecture rationale, browser/admin separation philosophy, open questions | You want context before reading the spec |
| `spec.md` | Package location, validation behaviour, dependencies, boundaries, known gaps | You're an engineer implementing against or extending this package |
| `modules.md` | Module map — which source files export what | You're tracing an import or adding a new module |
| `types.md` | Database type shape, generation rules, regeneration steps, TypeScript conventions | You're regenerating types or reading the schema |
| `conventions.md` | Singleton-vs-factory, file naming, barrel-only index, extension guidance | You're adding a new query pattern or module |
| `entities.md` | All schema entities — canvas tables, user_settings, leads, RPCs, and every applied amendment | You want the live schema definition for any table or function |

## Status

stable

## Original monolith

This capability was previously a single `openspec/current/db.md` file (1197 lines), split in change `split-monolithic-capability-specs` on 2026-05-12. Git history of the original file is preserved via `git log --follow openspec/current/db.md`.

## Related capabilities

- `platform.md` — overall context; capability map
- `auth.md` — primary type-only consumer (`Database` shape)
- `config.md` — runtime dependency (`supabase` accessor)
- `studio-workspace/README.md` — workspace surface that reaches db transitively via auth
