// the find
kysely-org/kysely
A type-safe TypeScript SQL query builder
Kysely is a TypeScript SQL query builder that tracks your schema through the type system — selected columns, aliases, joined subqueries, and CTEs all produce correct result types at compile time. It's not an ORM; it generates SQL and gets out of the way. Aimed at Node.js/Bun/Deno developers who want type safety without the abstraction overhead of Prisma.
The type inference is the real selling point: it parses column aliases like `pet.name as pet_name` and reflects them in the result type, and this holds through subqueries, joins, and `with` clauses — not just the happy path. The dialect system is cleanly separated (each dialect has its own compiler, introspector, adapter, and driver), so community dialects like PGlite slot in without patching core. The `sql` template tag and `DynamicModule.ref()` give you typed escape hatches instead of forcing you into a string and losing everything. Active maintenance with two core leads and a real Discord community — issues get answered.
No built-in relation loading: if you want Prisma-style `include`, you write the joins and shape the result yourself every time. Schema types aren't derived from your database automatically — you define them manually in TypeScript, and the community `kysely-codegen` tool to generate them from a live DB is a separate install that isn't always in sync. Complex dynamic queries — optional filters, conditional selects — fight the type system; the `$if()` helper only goes so far, and the docs have an entire recipe for handling 'excessively deep types' errors that TypeScript throws on large query compositions. Connection pooling is not included: you provide a pool object to the dialect config yourself.