Kysely (pronounced “Key-Seh-Lee”) is a type-safe and autocompletion-friendly TypeScript SQL query builder. Inspired by Knex. Mainly developed for Node.js but also runs on Deno and in the browser.
Kysely makes sure you only use tables and columns that are visible to the part of the query you're writing. The result type only has the selected columns with correct types and aliases. As an added bonus you get autocompletion for all that stuff.
As shown above, through the magic of TypeScript, Kysely is able to parse the alias given to
pet.name and add the
pet_name column to the result row type. Kysely is able to infer column names, aliases and types from selected subqueries, joined subqueries,
with statements and pretty much anything you can think of.
All API documentation is written in the typing files and you can simply cmd-click on the module, class or method you're using to see it. The same documentation is also hosted here.