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.

Ben Holmes's avatar picture
Ben HolmesAstro SWE
Kysely I love you, but I still can't spell your name
Dax "thdxr" Raad's avatar picture
Dax "thdxr" RaadSST core team
Kysely is the best written TS codebase I've ever seen
Harminder Virk's avatar picture
Harminder VirkAdonisJS creator
Kysely is great. Keeping an eye on it to see how it evolves in coming months
Gal Schlezinger's avatar picture
Gal Schlezingerfnm creator, Vercel SWE
Kysely is 🐐
Yusuke "yusukebe" Wada's avatar picture
Yusuke "yusukebe" WadaHono creator, Cloudflare DevRel
Kysely is great. D1 will be great. This is great.
"pilcrow"'s avatar picture
"pilcrow"Lucia creator
Ok, so I'm not a big fan of Drizzle. I don't like how I have to import everything when declaring schemas and queries, and I just prefer the simplicity and the overall API of Kysely.
Theo "t3dotgg" Browne's avatar picture
Theo "t3dotgg" BrowneUploadthing creator, Ping.gg CEO
Planetscale's DatabaseJS combined with Kysely or DrizzleORM is pretty dope to stay on edge
Nicholas Griffin's avatar picture
Nicholas Griffinsqs-consumer maintainer, BBC SWE
I don't actually like prisma that much, I prefer Kysely, not an ORM though.
Alberto "gimenete" Gimeno's avatar picture
Alberto "gimenete" GimenoRailway SWE
I'm a happy Kysely user. It's great to see that the code I'm writing now can work with serverless PostgreSQL now!
Johan Eliasson's avatar picture
Johan EliassonOneLab CTO
Instead of Prisma, I'm testing Kysely, Kysely Codegen, and Atlas. Works great.
Mehul Mohan's avatar picture
Mehul MohanCodedamn Founder
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.
Sam Cook's avatar picture
Sam CookGamma.io SWE
Kysely is amazing.
Gannon Hall's avatar picture
Gannon HallAstro Labs Founder
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-kysely.
Alisson "thelinuxlich" C.Agiani's avatar picture
Alisson "thelinuxlich" C.AgianiOpensourcerer
Kysely is superior and with each release gets even more awesome
"Sock, the dev"'s avatar picture
"Sock, the dev"Opensourcerer
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. ♥️
"CodeMonument"'s avatar picture
"CodeMonument"Opensourcerer
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! [...]

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