Install
DB-X is a small set of packages under the @db-x scope: a per-engine schema
library (@db-x/postgres-library today — MySQL and other engines are on the
roadmap), the @db-x/runtime, and the db-x CLI in
@db-x/cli.
The @db-x/* packages aren't published to npm yet (tracked in
#3). For now, install by cloning
the repo and building the workspace — the steps below.
Requirements
- Node.js 22 or newer.
- pnpm, npm, or yarn — examples use pnpm.
- Docker and
psqlon yourPATHif you want to run a schema against a local database (db-x applyshells out topsql).
Install (clone + build)
git clone https://github.com/rtorcato/db-x.git
cd db-x
pnpm install && pnpm build
This builds every package, including the db-x binary in @db-x/cli. Run it
from an example (cd examples/postgres && pnpm apply) or from any workspace
package that depends on @db-x/cli.
Once the packages are published, installing into your own project will be:
pnpm add -D @db-x/cli @db-x/runtime @db-x/postgres-library
JSX pragma
Every DB-X schema file declares its JSX runtime at the top:
/** @jsxRuntime automatic */
/** @jsxImportSource @db-x/runtime */
@db-x/runtime is DB-X's own JSX runtime — forked from Infra-X, now vendored
and maintained here. There is no @infra-x dependency, and nothing else is
needed to run DB-X: the db-x CLI is standalone.