Search for a command to run...
Type-safe SQL query builder for TypeScript that compiles queries at build time and keeps a thin, predictable mapping to raw SQL. Offers full autocompletion and schema-aware result types without ORM abstraction, letting teams write familiar SQL through a fluent API while catching errors before runtime.
Adopted by teams at Maersk, Cal.com, and Deno for production workloads. The Knex.js creator called it close to what he would build today with modern TypeScript. Distinguished from ORMs like Prisma and Drizzle by staying close to SQL: naming and structure mirror the database, queries compile one-to-one, and schema types can be generated from the database via kysely-codegen. Popular pairing is Prisma for migrations and schema plus Kysely for complex or performance-sensitive queries.
Key features:
Use cases: complex reporting and analytics where ORMs struggle, serverless or edge backends needing a lightweight runtime, teams that prefer SQL but want type safety and editor support. Developers pair it with Prisma or Drizzle for schema management and reach for Kysely when they need direct control over generated SQL.