MCPcopy
hub / github.com/kysely-org/kysely

github.com/kysely-org/kysely @v0.29.2 sqlite

repository ↗ · DeepWiki ↗ · release v0.29.2 ↗
3,371 symbols 8,538 edges 516 files 471 documented · 14%
README

Stand With Ukraine

NPM Version Socket Badge Tests License Issues Pull Requests GitHub contributors NPM Downloads JSR Downloads JSR Score

Join the discussion ⠀⠀⠀⠀⠀⠀⠀

Discord Bluesky

Get started

PostgreSQL MySQL MSSQL SQLite PGlite & more!

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

<a href="https://github.com/kysely-org/kysely/graphs/contributors">
    <img src="https://contrib.rocks/image?repo=kysely-org/kysely" />
</a>



<span>Want to contribute? Check out our <a href="https://github.com/kysely-org/kysely/raw/v0.29.2/CONTRIBUTING.md" >contribution guidelines</a>.</span>







<a href="https://vercel.com/?utm_source=kysely&utm_campaign=oss">
    <img src="https://kysely.dev/img/powered-by-vercel.svg" alt="Powered by Vercel" />
</a>

Extension points exported contracts — how you extend this code

KyselyPlugin (Interface)
(no doc) [19 implementers]
src/plugin/kysely-plugin.ts
OperationNodeSource (Interface)
(no doc) [86 implementers]
src/operation-node/operation-node-source.ts
Driver (Interface)
(no doc) [13 implementers]
src/driver/driver.ts
Expression (Interface)
(no doc) [7 implementers]
src/expression/expression.ts
ReadonlyConnectionBuilder (Interface)
(no doc) [27 implementers]
src/readonly/readonly-kysely.ts
QueryCompiler (Interface)
(no doc) [6 implementers]
src/query-compiler/query-compiler.ts
Explainable (Interface)
(no doc) [7 implementers]
src/util/explainable.ts
DatabaseIntrospector (Interface)
(no doc) [8 implementers]
src/dialect/database-introspector.ts

Core symbols most depended-on inside this repo

selectFrom
called by 929
src/expression/expression-builder.ts
execute
called by 900
src/util/executable.ts
select
called by 754
src/query-builder/select-query-builder.ts
testSql
called by 548
test/node/src/test-setup.ts
as
called by 517
src/raw-builder/raw-builder.ts
freeze
called by 485
src/util/object-utils.ts
where
called by 424
src/query-builder/where-interface.ts
append
called by 390
src/query-compiler/default-query-compiler.ts

Shape

Method 1,582
Function 872
Interface 578
Class 338
Enum 1

Languages

TypeScript100%

Modules by API surface

test/typings/test-d/huge-db.test-d.ts251 symbols
src/query-builder/select-query-builder.ts138 symbols
src/query-compiler/default-query-compiler.ts129 symbols
src/operation-node/operation-node-transformer.ts105 symbols
src/kysely.ts100 symbols
src/query-builder/merge-query-builder.ts50 symbols
src/migration/migrator.ts49 symbols
src/expression/expression-builder.ts44 symbols
src/readonly/readonly-kysely.ts43 symbols
src/dialect/mssql/mssql-driver.ts41 symbols
src/schema/alter-table-builder.ts38 symbols
src/query-builder/update-query-builder.ts37 symbols

Dependencies from manifests, versioned

@arethetypeswrong/cli0.18.2 · 1×
@ark/attest0.56.0 · 1×
@docusaurus/core3.10.1 · 1×
@docusaurus/module-type-aliases3.10.1 · 1×
@docusaurus/plugin-vercel-analytics3.10.1 · 1×
@docusaurus/preset-classic3.10.1 · 1×
@docusaurus/theme-common3.10.1 · 1×
@docusaurus/theme-mermaid3.10.1 · 1×
@docusaurus/tsconfig3.10.1 · 1×
@docusaurus/types3.10.1 · 1×
@mdx-js/react3.1.1 · 1×

Datastores touched

(mysql)Database · 1 repos
mydbDatabase · 1 repos

For agents

$ claude mcp add kysely \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact