Database type generator for Kysely ORM, supporting PostgreSQL, MySQL, SQLite, and MSSQL. Current stable version is 0.14.1 (released March 2025), actively maintained with weekly releases. Key differentiator: it generates TypeScript types directly from live database schemas, including enums, generated columns, and ColumnType distinctions. Supports Zod schema generation (v4+), camelCase conversion, and pattern-based table filtering. Requires Node >=20 or Bun >=1.
npm install kysely-genNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Illustrates installation, type generation from a PostgreSQL database, and usage of the generated types with a Kysely query.
Upgrade to zod@4 or remove the --zod flag if using older Zod versions.
Upgrade Node.js to 20+ or switch to Bun 1+.
Replace --schema with --include-pattern for table filtering.
Import types from your generated output file, e.g., import type { DB } from './db.d.ts'.Import Generated and ColumnType from your local db.d.ts, not from 'kysely'.
Run `npm install kysely-gen kysely <driver>` first, then use `npx kysely-gen`.
Check DATABASE_URL or --url parameter. Ensure database is accessible from your network.
Install the appropriate driver: `npm install pg` for PostgreSQL, etc.
Install zod@4: `npm install zod@4`.