Kysely is a type-safe TypeScript SQL query builder that works across multiple database systems including PostgreSQL, MySQL, SQLite, Microsoft SQL Server, and others.
The tool solves the problem of writing SQL queries in TypeScript while maintaining type safety and preventing runtime errors. It achieves this by leveraging TypeScript's type system to validate queries at compile time. Rather than concatenating strings or using template literals, Kysely provides a fluent API where each method call is type-checked against your database schema, catching mistakes before code runs. The builder generates SQL dynamically based on the dialect of the target database, handling the differences between PostgreSQL, MySQL, SQLite, MSSQL, and other systems automatically.
Kysely suits projects where type safety matters and where developers want to avoid the overhead of a full ORM. It works well in Node.js, Deno, Bun, and browser environments, making it flexible for various deployment targets. The tool is particularly valuable for teams already invested in TypeScript who want SQL queries to feel like a natural part of their codebase rather than strings that live outside the type system. It provides a middle ground between raw SQL strings and heavyweight ORMs, giving you control over your queries while catching errors early.
The project maintains active engagement with its community through Discord and social channels. Development shows consistent attention to supporting multiple database platforms and runtime environments. The tool receives ongoing refinement to improve the developer experience of writing type-safe queries across different SQL dialects.