kysely
Type safe SQL query builder
About
Type safe SQL query builder
Live mirror of the GitHub README. Updated whenever the repo's default branch changes.
Join the discussion ⠀⠀⠀⠀⠀⠀⠀
Get started
Kysely
Kysely (pronounce “Key-Seh-Lee”) is a type-safe and autocompletion-friendly TypeScript SQL query builder. Inspired by Knex.js. Mainly developed for Node.js but also runs on all other JavaScript environments like Deno, Bun, Cloudflare Workers and web browsers.

Kysely makes sure you only refer to 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 in the gif above, through the pure magic of modern TypeScript, Kysely is even 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.
Of course there are cases where things cannot be typed at compile time, and Kysely offers escape hatches for these situations. See the sql template tag and the DynamicModule for more info.
All API documentation is written in the typing files and you can simply hover over the module, class or method you're using to see it in your IDE. The same documentation is also hosted here.
If you start using Kysely and can't find something you'd want to use, please open an issue or join our Discord server.
Getting started
Please visit our documentation site kysely.dev to get started. We also have a comprehensive API documentation hosted here, but you can access the same documentation in your IDE by hovering over a class/method/property/whatever.
Core team
Project leads
Responsible for project direction, API design, maintenance, code reviews, community support, documentation, and working on some of the most impactful/challenging things.
|
Sami Koskimäki (the author) |
Igal Klebanov (the dynamo) |
Honorable mentions
People who had special impact on the project and its growth.
|
Fernando Hurtado (1st docs) |
Wirekang (playground) |
Tim Griesser (Knex) |
|
Robin Blomberg (codegen) |
Shoubhit Dash (prisma idea) |
Valtýr Örn Kjartansson (prisma impl) |
|
Dax Raad (early adopter) |
Theo Browne (early promoter) |
Lee Robinson (early promoter) |
|
Ethan Resnick (timely feedback) |
Harminder Virk (dope writeup) |
Johan Eliasson (promoter/educator) |
All contributors
Want to contribute? Check out our contribution guidelines.
Quick facts
npm install kyselyHow Sourcemap Explorer detects kysely
We catch kysely from two complementary signals: bundled source paths and the embedded package.json. Modern bundlers (webpack, Vite, esbuild, Rollup, Turbopack) preserve the original node_modules/kysely/ paths inside the JavaScript sourcemap's sources[] array — that's the canonical signal. When the matching package.json is also captured in sourcesContent[], we read the exact version field — patch number included. No regex guessing, no version inference.
- 1
Confirm the site exposes sourcemaps
In DevTools Network, check the response headers of any application script for `SourceMap` or `X-SourceMap`. Failing that, fetch the script's last 4 KB and look for a `//# sourceMappingURL=` comment.
- 2
Find the package in the bundle
Open DevTools → Network → reload. Click any application script and look at its sourcemap. Inside, search `sources[]` for entries matching `node_modules/kysely/` — every match confirms the package is bundled. The matching `sourcesContent[i]` for `node_modules/kysely/package.json` gives you the exact installed version.
- 3
Read the version directly from package.json
Run `jq -r '. as $m | $m.sources | to_entries[] | select(.value | endswith("node_modules/kysely/package.json")) | $m.sourcesContent[.key] | fromjson | .version' bundle.js.map`. Sourcemap Explorer automates the same query in the popup.
Recent versions
FAQ
What is kysely used for?
Type safe SQL query builder
How can I tell if a website is using kysely?
Open the page in Chrome with the Sourcemap Explorer extension installed and read the Stack tab. We catch `kysely` from two complementary signals: `node_modules/kysely/` paths inside the JavaScript sourcemap, and the embedded `package.json` we read for exact-version detection. Without the extension you can do the same lookup manually in DevTools — the steps are listed in the "How Sourcemap Explorer detects" section above.
What is the latest version of kysely?
0.29.2, as published on the npm registry. The "Recent versions" table on this page lists the most recent 8 releases with their release dates. Sourcemap Explorer reports the version actually bundled into a site, which can lag the latest release by months on real-world deployments.
Where can I read more?
Project homepage: https://kysely.dev. Source code: https://github.com/kysely-org/kysely. Published on npm: https://www.npmjs.com/package/kysely. Licensed as MIT.
Keep reading on Sourcemap Explorer
Practical guides
Detected by Sourcemap Explorer
When a bundle ships sourcemaps, we read the embedded package.json for kysely and report the precise version. Without sourcemaps, an import / require in the page's scripts is enough to flag it.