Updated

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.

Open sourceSelf-hostableFree tier

Profile checked

Works with AI agents:llms.txt
Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

How makers use Kysely

What Kysely is used for

Database Access & ORMs · Query builder →A type-safe SQL query builder for TypeScript, with no schema file or code generation step of its own.Trade-off: A query builder rather than a full ORM — migrations are basic and relations are joins you write.
Prisma37Drizzle ORM12SQLAlchemy1Kysely0TypeORM0Makers' products on each, for database access & ORMs

Kysely vs the alternatives makers chose

OptionMakers' productsOpen source
Prisma37 74%Yes
Drizzle ORM12 24%Yes
SQLAlchemy1 2%Yes
Kysely0 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

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.
From each decision's guide, written from what makers' products chose and why.

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

YearComments choosing it, per monthNet praise
20230.7+43%
20240.9+42%
20250.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

Open on 2026-10-04 in kysely-org/kysely, with activity in the last year — issues and feature requests by 👍.

Who switches

More projects move to Kysely: 15 pull requests in, 6 out; the most come from Prisma and leave for Drizzle ORM.

Moving to KyselyMoving away
Kysely
Prisma → Kysely10 PRs
Drizzle ORM → Kysely5 PRs
Kysely → Drizzle ORM6 PRs

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.

lobu
lobuOpen-source control plane and runtime for organisational agents: shared company context…Database Access & ORMsIn its code · source ↗
sdk
sdkA simple framework for humans Server-first React, running on the Cloudflare platform. Si…Database Access & ORMsIn its code · source ↗
delta-comic
delta-comic✨ Delta Comic — 一个以体验为先的多源漫画聚合客户端(Tauri/Android)。 📚 插件驱动 · 🔍 多站整合(Bika / PicaCG / JMCo…Database Access & ORMsIn its code · source ↗

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.

1,882words in the median file
pnpmthe package manager most named, in 10 of 20 files
75%say how to test a change
Named more in these files than in other projects' — in how many of the 20:
What AGENTS.md files say about other tools →What open-source products tell their coding agents →

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 ↗