Skip to main content

Kysely

The type-safe SQL
query builder for TypeScript

Getting startedView on Github

Type-safe SQL queries

Kysely let's you write type-safe SQL queries. This eliminates entire classes of errors and let's you sleep peacefully at night.

No magic, just SQL

Kysely is a light abstraction layer over SQL. This makes it easy to reason about performance, and reduces the amount of concepts you need to learn to be proficient with the library.

Great autocompletion

By exposing your database schema to the TypeScript compiler, you get autocompletion on table names, column names, aliases, etc.

Multi-dialect support

PostgreSQL, MySQL, or SQLite? We've got you covered. There's also a growing ecosystem of 3rd party dialects, including PlanetScale, D3, SurrealDB, and more. Learn more.

Runs on every environment

Kysely runs on node.js, the browser, serverless and edge environments, even on Deno! Learn more.

Extensible core

Kysely comes with a plugin system that lets you extend the core with your own functionality. Learn more.

What the internet is saying

Developers are loving Kysely for it's simplicity and power.

Dax Raad@SST_dev core team
Kysely is the best written TS codebase I've ever seen
Yusuke WadaCreator of @honojs
Kysely is great. D1 will be great. This is great.
Gal SchlezingerSoftware Developer @ Vercel, Creator of fnm
Kysely is 🐐
Theo BrowneCEO @ Ping Labs, tech influencer
Planetscale's DatabaseJS combined with Kysely or @DrizzleOrm is pretty dope to stay on edge
Johan EliassonIndiehacker & engineer, Ex-CEO @ Nhost
Instead of Prisma, I'm testing Kysely, Kysely Codegen, and Atlas. Works great.
Mehul MohanCEO @ codedamn
We went with query builder because we did not have more time to waste on ORMs. ORMs might be great but we have the technical capability to pull off just using a query builder. However, we type safety and sanitization for DX and security was a must - hence kysely.
Alberto GimenoSoftware Engineer @ Railway
I'm a happy @kysely_ user. It's great to see that the code I'm writing now can work with serverless postgresql now!
Nicholas GriffinSenior Engineer @ the BBC
😂 I don\'t actually like prisma that much, i prefer https://github.com/kysely-org/kysely, not an orm though.
Sam CookSoftware engineer @ trygamma
Kysely is amazing.
Gannon HallProduct & dev, ex-Google
Vercel just announced native postgres support and published Prisma and Kysely templates. I like the DX of Prisma and the type safety of Kysely so I use both via prisma-kysley.
@CodeMonumentCodeMonument
deno + @planetscale/database + kysely + kysely-planetscale is absolutely awesome! Knew nothing about the adapter and Kysely before and got the PoC in Code in 45 minutes. It's so stupidly simple! [...]
sommelier de garrafada@solinvictvs
Kysely is superior and with each release gets even more awesome
Sock, the dev 🧦@sockthedev
YES! Completed the initial version of this. Finally. Huge shoutout to Kysely for making this way less painful than it should have been. The BEST TypeScript based SQL query builder. ♥️

Try it out for yourself!

Modify the query on the left and view the generated SQL on the right.

Looking for code examples?

From finding a single record to complex joins, our docs have examples to get you started quickly.

Jump right in