
Kysely
Type-safe TypeScript SQL query builder for Postgres, MySQL and SQLite, with types inferred from your database schema.
43 open-source projects declare Kysely in their code; no maker's live product we track uses it yet. What makers like most: It is a thin, SQL-shaped query builder with unusually strong TypeScript typing, so you keep writing SQL without hiding it behind an ORM. Their most common complaint: Not being an ORM, it does not generate migrations or offer declarative schemas, and rows still need mapping into objects. On GitHub, 15 public pull requests moved projects to Kysely from tools we list, and 6 moved them away.
Profile checked
Works with AI agents:llms.txtHow makers use Kysely
What Kysely is used for
Kysely vs the alternatives makers chose
| Option | Makers' products | Open source | |
|---|---|---|---|
| 37 74% | Yes | ||
| 12 24% | Yes | ||
| 1 2% | Yes | ||
| 0 0% | Yes |
For database access & ORMs: how many of the 50 makers' products we know the database access & ORMs of chose each option.
When to use Kysely, and when not
Pick Kysely if
- You already write SQL comfortably and only want types around it, no schema layer. Database Access & ORMs →
Something else fits better if
- You want one schema file that generates types, migrations and a readable query API: Prisma.
- You deploy to serverless or edge functions and want queries that read like SQL, fully typed: Drizzle ORM.
- Your backend is Python and not Django: SQLAlchemy.
Kysely is a TypeScript library for building SQL queries with full type checking. It is not an ORM: you think in tables and joins, but the compiler knows which tables and columns are in scope at each point of a query and what shape the result rows will have.
More about Kysely
The model is small. You give the Kysely constructor a TypeScript interface describing your database's tables, plus a dialect, the adapter for one database engine. Built-in dialects cover PostgreSQL, MySQL, SQL Server, SQLite and PGlite, and community dialects add Postgres.js, serverless drivers for PlanetScale and TiDB, Cloudflare Durable Objects and others. Queries are chained method calls that compile to SQL. Kysely infers columns and aliases even through subqueries and CTEs; a sql template tag covers the rest.
What you get: transactions, including controlled ones with savepoints; helpers such as jsonArrayFrom that fetch nested objects and arrays in a single query; a plugin system that hooks into query compilation and results; and a built-in migrator that runs ordered up and down functions. It is mainly developed for Node.js but also runs on Deno, Bun and in browsers, where it can compile SQL without a connection.
Limits: Kysely has no relations or models, so no automatic eager loading or change tracking. It does not create your schema types for you either; you write them by hand or generate them with third-party tools such as kysely-codegen or prisma-kysely. Migrations are code you write, not diffs generated from a schema.
How Kysely itself is built
8 tools, from its own code, website and Product Hunt page.
Kysely pros and cons
What makers like most: It is a thin, SQL-shaped query builder with unusually strong TypeScript typing, so you keep writing SQL without hiding it behind an ORM. Their most common complaint: Not being an ORM, it does not generate migrations or offer declarative schemas, and rows still need mapping into objects.
Pros
- It is a thin, SQL-shaped query builder with unusually strong TypeScript typing, so you keep writing SQL without hiding it behind an ORM. HNHN 2HN 3HN 4
- Queries compose well, which handles dynamic filters and even serves as the engine for other ORMs. HNHN 2HN 3
- It sits alongside Prisma or plain SQL schemas for performance-critical queries and SQL features an ORM does not support. HNHN 2HN 3HN 4
- Teams moving off heavier ORMs like TypeORM saw big gains in query speed and memory use. HNHN 2
Cons and watch-outs
- Not being an ORM, it does not generate migrations or offer declarative schemas, and rows still need mapping into objects. HNHN 2HN 3
- Complex queries are harder to translate into builder calls than to write in SQL directly. HNHN 2
- Support varies by dialect; the ClickHouse extension is immature and features like savepoints depend on the dialect. HNHN 2
Themes that recur in makers' words and Hacker News comments, each linked to what it summarises.
What Hacker News says about Kysely
On Hacker News, 51% of comments about Kysely recommend it and 7% criticize it: net praise +44%, the best liked of 4 tools HN discusses for database access & ORMs.
By year
| Year | Comments choosing it, per month | Net praise |
|---|---|---|
| 2023 | 0.7 | +43% |
| 2024 | 0.9 | +42% |
| 2025 | 0.8 | +46% |
| 2026 (8 mo) | 0.6 | +50% |
In their words
- “I would have used Kysely instead of just raw porsager.” HN, Mar 2026
- “I like Kysely more than Drizzle, even moreso now with Claude” HN, Feb 2026
- “the Clickhouse extension was not far along enough to make sense for our use-case” HN, Aug 2025
Hacker News comments January 2023 to August 2026 that name Kysely in a sentence like "I use" or "we moved to", Claude read a sample of 45 and the counts scale it to all of them; net praise is comments recommending it minus comments criticizing it, as a share of all comments about it. How it's counted, and how HN compares with makers.
Reliability and open issues
The most wanted open issue on GitHub has 24 👍.
Most wanted on GitHub
- You're awesome! Thank you 🙏🏽👍 24 · opened Dec 2025 · active Dec 2025
- add Snowflake dialect.👍 23 · opened Jan 2026 · active May 2026
- Suggestion: Allow Execution driver to execute multiple queries👍 22 · opened Mar 2024 · active Dec 2025
- Add a way to stream raw query results.👍 15 · opened Mar 2025 · active Nov 2025
- [Feature] Allow window function modification👍 11 · opened May 2023 · active Jan 2026
Who switches
More projects move to Kysely: 15 pull requests in, 6 out; the most come from Prisma and leave for Drizzle ORM.
Prisma → Kysely10 PRs
- refactor(db): Phase 3 — migrate Prisma master-table repositories to Kysely (#62)flipslidersand-labs/loopnest-core · 2026-09-06
- fix: three bugs found while scoping the Prisma to Kysely migrationcivitai/civitai · 2026-08-09
- Migrate excavator-web from Prisma to Kysely to fix runaway memory usageloathers/excavator · 2026-07-24
- Migrate database layer from Prisma to Kyselyloathers/museum · 2026-05-10
- Migrate from Prisma to Kyselyloathers/greenbox · 2026-05-10
- Migrate from prisma to kysely because prisma has become annoyingloathers/oaf · 2026-02-13
- Migration from Prisma ORM to Kysely queries + update Zod from v3 to v4introbotai/linkedin-resolver · 2025-12-26
- feat: migrate from Prisma to Kysely for better performanceruidolp/wapp · 2025-11-06
- Migrate from prisma to kyselylpgera/cookbook · 2025-11-02
- feat: Switch from Prisma to Kysely for the meantimeredwoodjs/sdk · 2024-11-26
Drizzle ORM → Kysely5 PRs
- migration: drizzle to kysely, slim down to data APIdvgamerr-app/aide-collector · 2026-06-17
- refactor(db): switch from drizzle to kysely + atlasponti-studios/hominem · 2026-03-07
- feat: migrate hono example from Drizzle to KyselyAndrey-jpeg/goodie · 2026-03-01
- feat: migrate hono example and docs from Drizzle to KyselyAndrey-jpeg/goodie · 2026-03-01
- refactor!: change drizzle to kysely for internal querieswannabespace/conar · 2025-11-14
Kysely → Drizzle ORM6 PRs
- refactor(api): switch from Kysely and dbmate to Drizzle ORM and drizzle-kityutaasakura96/overload · 2026-09-25
- Add SQL to Kysely generator and upgrade SQL to Drizzle tooldaxt61/multi-tool-site · 2026-09-23
- refactor(db): migrate from kysely to drizzleblinkdisk/blinkdisk · 2026-06-28
- Migrate Playwright tests from Kysely to Drizzle ORM and add CI workflowncrmro/website · 2025-12-24
- Migrate from Kysely to Drizzle ORMncrmro/website · 2025-11-20
- Migrated from Kysely to Drizzle and implemented a Demo modeRaulRohjans/spenser · 2025-08-18
Public pull requests on GitHub since Oct 2024 whose title says "X to Y" — real code changes moving a project from one tool to another, by developers in general.
Who uses it
No maker's live product on record yet, and 43 open-source projects that declare it in their code.
We haven't found a maker's live product that uses Kysely yet — only the open-source projects below, which declare it in their code.
None of these in makers' own words.
Open source: a project that declares Kysely as a dependency in its public code — verifiable, but not necessarily a live product.
What its projects tell coding agents
22 of the 33 open-source products built with Kysely that were worked on in the last 180 days keep instruction files for coding agents — 67%, against 53% of all the projects we read. AGENTS.md is in 20, CLAUDE.md in 12.
Alternatives to Kysely
All alternatives by situation →Questions makers ask about Kysely
What are the pros and cons of Kysely?
Pros makers name: It is a thin, SQL-shaped query builder with unusually strong TypeScript typing, so you keep writing SQL without hiding it behind an ORM. Queries compose well, which handles dynamic filters and even serves as the engine for other ORMs. It sits alongside Prisma or plain SQL schemas for performance-critical queries and SQL features an ORM does not support. Cons: Not being an ORM, it does not generate migrations or offer declarative schemas, and rows still need mapping into objects. Complex queries are harder to translate into builder calls than to write in SQL directly. Support varies by dialect; the ClickHouse extension is immature and features like savepoints depend on the dialect.
What are the alternatives to Kysely?
For database access & ORMs, the other options makers' products we track chose most are Prisma (37), Drizzle ORM (12), SQLAlchemy (1). Open source or self-hostable among them: Prisma, Drizzle ORM, SQLAlchemy. Each alternative, with the situation it fits, is on the Kysely alternatives page.
Do developers switch to or away from Kysely?
On GitHub, 15 public pull requests moved projects to Kysely from tools we list, most from Prisma (10), Drizzle ORM (5); 6 moved them away, most to Drizzle ORM (6).
When should you use Kysely?
You already write SQL comfortably and only want types around it, no schema layer (database access & ORMs). Something else fits better if: you want one schema file that generates types, migrations and a readable query API, pick Prisma; you deploy to serverless or edge functions and want queries that read like SQL, fully typed, pick Drizzle ORM.
Which databases does Kysely support?
Built-in dialects cover PostgreSQL, MySQL, Microsoft SQL Server, SQLite and PGlite. Community dialects add Postgres.js, SingleStore, the PlanetScale and TiDB serverless drivers, Cloudflare Durable Objects, AWS RDS Data API, ClickHouse and more. source ↗
Do I have to write the database types by hand?
You can, but Kysely recommends generating them for production apps with third-party tools; kysely-codegen introspects a live database, prisma-kysely reads an existing Prisma schema, and kanel-kysely covers PostgreSQL. source ↗
Can I load related rows like an ORM?
Kysely has no relations, but helpers such as jsonArrayFrom and jsonObjectFrom fetch nested arrays and objects in one query. They may not work with third-party dialects that return JSON as strings. source ↗
How do migrations work?
Each migration exports up and down functions that receive a Kysely instance and run in alphanumeric order of their names; Kysely errors if a new migration sorts before already-run ones unless you enable allowUnorderedMigrations. Migrations should not import your app code, so they stay fixed in time. source ↗
Does it run outside Node.js?
Yes. Kysely is mainly developed for Node.js but also runs on Deno, Bun and other JavaScript environments, and in browsers it can compile queries without a database connection. source ↗
What if the query builder cannot express my query?
Use the sql template tag to write raw SQL fragments, which can be mixed into builder queries, as an escape hatch for cases that cannot be typed at compile time. source ↗
Is Kysely free?
Yes — it is free, open-source software.
Is Kysely open source or self-hostable?
Open source, and you can self-host it. source ↗
Can AI coding agents work with Kysely?
It serves an llms.txt docs index.
Who uses Kysely?
No maker's live product we track yet; 43 open-source projects declare it in their code. source ↗