Documentation

okmodel is a catalog-first TypeScript ORM, PostgreSQL first.

The schema is the source. Migrations and queries come from it. Start with one table, then add only the part you need.

0.9 adds tooling around that schema: pull writes table files from a database, import drizzle writes them from a Drizzle schema, catalogs share one database, describe returns the catalog as JSON, extension packs cover the contrib set except vector, the GitHub Action posts the plan, and a type change that rewrites a table is five migrations.

The source

The tables you declare are the catalog. Queries, migrations, and checks come from that catalog.

schema.ts
import { table, t } from "okmodel/pg";

export const notes = table("notes", {
  id: t.identity(),
  title: t.text(),
});

01 Start

Add the package, then one table. The next page is one example per call.

02 Define

Each table, the schema, the client, and the config file. Open the page for the object you are setting.

On this page