Your database
create table users ( id uuid primary key, email text not null, status user_status not null);create table posts ( id uuid primary key, user_id uuid references users);What it generates
// POST /v1/users/listconst { data } = await sdk.users.list({ where: { status: "active" }, include: { posts: true },});data[0].posts; // Post[]Tool
postgresdk
Point it at a Postgres database and it generates a typed Hono API plus a TypeScript client that matches it exactly.
bun add postgresdkpostgresdk generates a typed API and a matching client from a Postgres database. The server side is a Hono router with typed routes, Zod validation, and API key or JWT auth. The client side is a TypeScript SDK with typed CRUD, includes for loading relations, transactions, where filtering and pagination.
It's a CLI. Given a connection string, the generate command introspects the schema and writes both halves into the project as TypeScript, with the types and enums taken from the tables. When the schema changes, running it again regenerates everything.
It exists because the routes and the client for an app usually get typed out by hand from the same tables, and the two drift apart over time. Generating both from the database keeps them matched to the schema and to each other.
It's on npm and under active development, so the API can change between versions, and Hono is the only supported server framework so far. The docs at docs.postgresdk.com are generated from the source.
- Built by
- Ben
- Built with
- Postgres
- TypeScript
- Shipped
- August 8, 2025
- Status
- live
- Tags
- codegenclihonozod
Built by Ben