DB-X
Production-grade database schema deployment, with a Time Machine and AI review.
DB-X is a schema deployment and migration tool with its own JSX runtime, forked from Infra-X. Same JSX-as-IaC mental model, specialised for relational databases: write your schema declaratively, preview the change, apply it with snapshots and rollback, and let an AI agent review it before it ships.
It is the part of Drizzle / Prisma / Flyway that runs in production — not the query DSL. You keep Drizzle (or whatever ORM you like) for your application code; DB-X owns the deployment of the schema underneath it.
import { Column, Postgres, Table } from '@db-x/postgres-library';
<Postgres name="todos-db" {...PG}>
<Table name="todos">
<Column name="id" type="serial" primaryKey />
<Column name="title" type="text" notNull />
<Column name="done" type="boolean" notNull default="false" />
</Table>
</Postgres>;
Standalone
DB-X runs on its own with the db-x CLI: a schema file uses
<DatabaseTarget url={...}> to point at any Postgres — a local container or a
managed DB — and db-x apply runs the DDL. There is no Infra-X dependency in
the tree; @db-x/runtime is DB-X's own runtime, forked and now maintained
separately.
Packages
DB-X is a small set of packages built on @db-x/runtime (not on npm yet —
see Install). Each component is created with
defineComponent; import a package and its components register automatically.
@db-x/postgres-library— declarative Postgres schema components:Postgres,Table,Column, indexes, and seed data. The API surface you write your schema against.@db-x/cli— thedb-xCLI.preview,apply,destroy, anddescribeship today; snapshot / restore and Shadow-DB preview are on the roadmap.
The full generated API reference is derived from the package sources.
Where to go next
- Install — Get
db-xon your machine. - Quickstart (Docker) — Run the schema against a local Postgres in Compose.
- Quickstart (managed DB) — Point DB-X at an RDS / Cloud SQL / Supabase URL.
- Time Machine — Snapshots, restore, history, diff.
- Shadow-DB preview — Catch the bad migration on a copy first.
- AI review — Wire the MCP server into Claude / Cursor / Cline.
- Why DB-X — How this relates to Drizzle, Prisma, and Flyway.
Status
Experimental — do not point it at a database you care about. The db-x CLI
runs today: preview, apply, destroy, and describe work end-to-end
against a real Postgres, as shown in Quickstart (Docker).
Snapshot / restore (Time Machine), Shadow-DB preview, the MCP server, and type
export are still on the roadmap.