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.

Lee "leerob" Robinson's avatar picture
Lee "leerob" RobinsonNext.js comm lead, Vercel VP of DX
Type-safe SQL queries with PlanetScale and Kysely 😍
Orta Therox's avatar picture
Orta TheroxEx-TypeScript team
👋 been using Kysely for a few days in Deno and Node, just wanted to say it's been going really well and it feels like a nice abstraction - kudos!
Ben Holmes's avatar picture
Ben HolmesAstro SWE
Kysely I love you, but I still can't spell your name
Julius Marminge's avatar picture
Julius MarmingetRPC & create-t3-app core team
Utterly astounded by how Kysely manages to make all of this typesafe. Seems like no matter how complex you get, it can infer it correctly.
Shoubhit "nexxel" Dash's avatar picture
Shoubhit "nexxel" Dashcreate-t3-app creator
kysely is great btw
Tim Griesser's avatar picture
Tim GriesserKnex.js creator, Cypress SWE
👋 First just wanted to say this project looks awesome! Pretty close to what I wish Knex was if I started it now, with the affordances of modern TypeScript instead of 10 years ago when we were stuck in ES5 and Promises weren't even really an official language construct yet.
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.
R. Alex Anderson's avatar picture
R. Alex AndersonThorium Nova creator
Shout out to Kysely for adding extensive JSDoc comments above the methods. It makes it much easier to figure out how to use it the way I want without having to dig into the docs. (though the docs are vv good too)
Ross Coundon's avatar picture
Ross Coundonleadent digital CTO
I particularly like Kysely here, it's a type-safe query builder and as such doesn't enforce the specifics of an ORM on you, therefore I feel, in the medium-to-long term, it'll save you the time and effort of working around ORM-specific and enforced structures/approaches
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

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