Kysely is a type-safe TypeScript SQL query builder that provides unparalleled autocompletion and compile-time safety for database queries. Inspired by Knex.js but built from the ground up with TypeScript in mind, Kysely ensures that you can only reference tables and columns that actually exist in your database schema, catching errors before your code ever runs. It runs on Node.js, Deno, Bun, Cloudflare Workers, and web browsers, making it a versatile choice for modern JavaScript runtimes.
Kysely stands out as a thin abstraction layer over SQL, designed by SQL enthusiasts who want predictable one-to-one query compilation rather than magical ORM behavior. It provides smart column inference that restricts field access to only the columns visible in each part of a query, ensuring result types include only selected columns with correct types and aliases. Kysely supports the full range of SQL operations including SELECT, INSERT, UPDATE, DELETE, MERGE, WITH clauses, and complex subqueries, all with complete type safety and autocompletion support.
Kysely is targeted at TypeScript developers and teams proficient in SQL who want the safety of type checking without sacrificing control over their queries. It is used in production by companies like Deno, Maersk, and Cal.com, demonstrating its readiness for enterprise workloads. Kysely integrates with PostgreSQL, MySQL, and SQLite through dialect-specific drivers, and its plugin system allows extending functionality with custom transformations, making it an excellent choice for projects where type safety and SQL familiarity are top priorities.