Broken queries don't ship
Non-existent tables, misspelled columns, mistyped values: Kysely surfaces them as you type, as agents code, and as your schema evolves, not in production at 3am.
When a column gets renamed, the TypeScript compiler walks you through every query that needs updating.
const rows = await db
.selectFrom('person')
.select('first_name')
.where('person.ag', '>', 18)
.execute()Queries that compose
Extract any fragment of a query into a plain, typed function and reuse it across queries. Expressions, subqueries, and CTEs all compose the same way. It's just TypeScript.
Here, a correlated subquery returns each person's pets as typed, nested JSON. One query, one round trip, no relations DSL to learn.
function withPets(
eb: ExpressionBuilder<DB, 'person'>,
) {
const pets = eb
.selectFrom('pet')
.select(['name', 'species'])
.whereRef('owner_id', '=', 'person.id')
return jsonArrayFrom(pets).as('pets')
}
const person = await db
.selectFrom('person')
.select(['id', 'first_name'])
.select(withPets)
.executeTakeFirstOrThrow()Show this to your boss!
What Kysely optimizes for.
Type safety above all
Precise TypeScript result types and compile-time errors within queries. With kysely-codegen, your database is the source of types.
What you see is what you get
A thin abstraction layer over SQL, crafted by SQL lovers for SQL lovers. Familiar naming, predictable 1:1 query compilation.
Your schema, autocompleted
Your database schema types flow through Kysely's fluent API. A typing experience second only to full-blown database IDEs.
Freedom of expression
Spec-faithful APIs for everything production teams need, composable all the way down, escape hatches everywhere.
Run anywhere
No environment-specific APIs, nothing to bundle around. Runs in Node.js, Deno, Bun, AWS Lambda, Cloudflare Workers, and browsers.
Opt-in your flavors
Plugins modify queries before compilation and results after execution. camelCase to snake_case and back, for example.
Manual included
Everything is documented inline, with type-checked code examples that can't drift. Hover docs for humans, rich context for agents.
Query any SQL database
PostgreSQL, MySQL, MS SQL Server, SQLite, and PGlite out of the box, plus a community-driven dialect system for everything else.
Trusted by the people who build your other tools
Unprompted, in public, on the record.












































































































