# CapsuleDB

> CapsuleDB lets an Effect library own its tables, typed queries and migrations inside the host app's existing database.

## Docs

- [CapsuleDB documentation](https://capsuledb.arya.sh/docs): How CapsuleDB splits database work between a package that owns private tables and the host app that owns the client, with a guide for each side.
- [Quick start](https://capsuledb.arya.sh/docs/quickstart): Declare a capsule with one private table and a typed service, compose it over a host-owned Bun SQLite client, and run it end to end.

### Guides

- [Capsule-author contract](https://capsuledb.arya.sh/docs/capsule-authors): Define a CapsuleDB capsule: a stable ID, tables declared once, append-only migrations, and an opaque Effect service the host composes.
- [Host-operator contract](https://capsuledb.arya.sh/docs/host-applications): Compose capsules over the client your app already owns: preparation, readiness checks, deploy-time preparation, and destructive authorization.
- [Provider capability matrix](https://capsuledb.arya.sh/docs/providers): The provider profiles CapsuleDB supports (PostgreSQL, Bun SQLite, libSQL and Cloudflare D1) and the bounded atomic-batch contract D1 runs under.
- [Migrations and recovery](https://capsuledb.arya.sh/docs/migrations-and-recovery): How CapsuleDB migration history changes over time, what each startup state means, and how to recover from drift, failed preparation or removal.
- [Design principles](https://capsuledb.arya.sh/docs/design): The principles behind CapsuleDB: the host's SqlClient is the seam, a capsule is a value, identity is derived, and what the library refuses to do.

### Project

- [Changelog](https://capsuledb.arya.sh/docs/changelog): Every published CapsuleDB release, newest first, with its breaking changes and the Effect and SQL driver versions it requires.
- [Releasing CapsuleDB](https://capsuledb.arya.sh/docs/releasing): How CapsuleDB is versioned and published: Tegami changelog entries, the version pull request, npm trusted publishing and the gates before release.

## Agent resources

- [llms-full.txt](https://capsuledb.arya.sh/llms-full.txt): The full Markdown of every page in one file.
- [Page Markdown](https://capsuledb.arya.sh/index.md): Append `.md` to any page URL to fetch that page as raw Markdown.
- [JSON API](https://capsuledb.arya.sh/api/docs/pages.json): Page index of the JSON docs API; each entry links the page's JSON and Markdown forms. Described by the OpenAPI document at https://capsuledb.arya.sh/openapi.json.
- [Agent skills](https://capsuledb.arya.sh/.well-known/agent-skills/index.json): Agent Skills discovery index of the skills this site publishes.
- [API catalog](https://capsuledb.arya.sh/.well-known/api-catalog): RFC 9727 linkset of the APIs documented here.
- [AI catalog](https://capsuledb.arya.sh/.well-known/ai-catalog.json): ARD manifest of the agent-facing resources on this site (MCP server, skills, APIs).
- [agent-readability.json](https://capsuledb.arya.sh/agent-readability.json): Manifest of every agent-facing artifact on this site.
- [Sitemap](https://capsuledb.arya.sh/sitemap.xml): Every indexable page URL with its last-modified date.
