Skip to content
whichdevtool?
Categories ▾

Frameworks and UI

Frontend and full-stack frameworks Backend frameworks UI component libraries

Hosting

VPS and cloud servers App hosting and PaaS

Data

Managed databases File and object storage ORMs and database toolkits

AI

AI model APIs

Email

Transactional email APIs Email marketing and newsletters

Payments

Payments and billing

Domains and edge

Domain registrars CDN, DNS and edge security

Operations and identity

Monitoring, uptime and error tracking Auth and identity Background jobs, queues and workflows
Stacks Directory
Ctrl K

Search directory
Menu
StacksDirectory Pricing changes Glossary
VPS and cloud servers App hosting and PaaS Managed databases Transactional email APIs Email marketing and newsletters Domain registrars CDN, DNS and edge security Monitoring, uptime and error tracking Auth and identity Frontend and full-stack frameworks Backend frameworks UI component libraries AI model APIs File and object storage Payments and billing Background jobs, queues and workflows ORMs and database toolkits
  1. Home
  2. ORMs and database toolkits
  3. Kysely
Ky

Type-safe TypeScript SQL query builder · by Kysely (community project)

Kysely

Type-safe TypeScript SQL query builder that infers result types from your database schema, compiles one-to-one to SQL and runs in Node, Deno, Bun, Workers and browsers.

Visit kysely.dev ↗ Alternatives Open source Open source Self-hostable
kysely.dev
Kysely homepage
§1

Overview

Kysely is a TypeScript SQL query builder started in 2021 by Sami Koskimäki (also the author of Objection.js) and now led by him and Igal Klebanov, under the MIT licence. It was inspired by Knex but built around modern TypeScript: it only lets you reference tables and columns that are in scope for the query you are writing, and the result type contains exactly the selected columns and aliases, including those from subqueries and CTEs.

There are no entities, models or relation declarations. Nested data is loaded with helpers such as jsonArrayFrom that build correlated subqueries, so one round trip returns typed nested JSON. You supply a Database type yourself or generate it from a live database with the community kysely-codegen tool; the Prisma generator prisma-kysely is another route.

Kysely ships dialects for PostgreSQL, MySQL, SQL Server, SQLite and PGlite, and community dialects cover others such as D1, PlanetScale and libSQL. A built-in Migrator runs up and down migrations written in TypeScript, but it does not diff schemas or generate migrations for you.

§2

Pricing and plans

Plan Price What you get
Kysely $0 MIT licence

Free and open source under the MIT licence; there is no paid product.

Source: github.com/kysely-org/kysely · prices as published, excluding tax.

§3

What it does

Scope-aware typing
Only tables and columns visible at that point of the query autocomplete; misspelled columns are compile errors.
Precise result types
Result rows contain exactly the selected columns and aliases, inferred through joins, subqueries and CTEs.
Composable expressions
Query fragments can be extracted into plain typed functions and reused across queries.
Migrator
Runs up/down migration files in order, with an option to allow unordered migrations for teams.
Plugins
Transform queries before compilation and results after execution, for example camelCase to snake_case.
Runs anywhere
No runtime dependencies; works in Node, Deno, Bun, AWS Lambda, Cloudflare Workers and browsers.
§4

Strengths and limitations

Strengths

  • Predictable one-to-one SQL output, with little hidden behaviour
  • Very precise TypeScript inference, including aliases and subqueries
  • Zero runtime dependencies; suitable for edge runtimes
  • Used as the SQL layer inside other tools, including MikroORM 7

Limitations

  • Not an ORM: no entities, relation mapping, change tracking or lazy loading
  • Migrations are written by hand; there is no schema diffing or migration generation
  • Database types must be written by hand or generated with a separate community tool (kysely-codegen)
  • Complex type inference can slow the TypeScript compiler on very large queries
§5

Who it suits

Good for

  • TypeScript developers who know SQL and want compile-time checks
  • Serverless and edge apps that need a small dependency-free layer
  • Replacing Knex in an existing codebase

Look elsewhere if

  • Teams that want an ORM with models and generated migrations (Prisma, Drizzle, MikroORM)
  • Developers who do not want to write SQL-style queries
§6

Alternatives to Kysely

Tool From Free option Stages
Da
Dapper .NET micro-ORM
— Open source
SQ
SQLx Async Rust SQL toolkit
— Open source
Bu
Bun (Go ORM) SQL-first Go ORM
— Open source
EO
Eloquent ORM Active Record ORM for Laravel
— Open source
Sq
sqlc SQL-to-code compiler
— Open source
Drizzle ORM SQL-like TypeScript ORM
— Open source

All ORMs and database toolkits →

§7

Questions

Is Kysely an ORM?

No. It is a type-safe SQL query builder with no models or relation mapping; nested data is loaded with JSON subquery helpers.

How do I get types for my database in Kysely?

Write a Database interface by hand or generate it from a live database with kysely-codegen.

Does Kysely support migrations?

Yes, it has a Migrator that runs up and down migration files you write; it does not generate them.

Kysely vs Drizzle: which should I use?

Both are SQL-shaped; Drizzle adds schema-in-code, a relational API and generated migrations, while Kysely stays a pure query builder with types from your database.

Sources read for this page

  • https://kysely.dev/
  • https://github.com/kysely-org/kysely
  • https://kysely.dev/docs/migrations
Spec sheet
From
Open source
Free tier
Free to self-host
Stages
HobbyIndieStartupScale-upEnterprise Suits hobby, indie, startup, scale-up
Language
TypeScript / JavaScript
Approach
Query builder (no entities or relations layer)
Databases
Postgres, MySQL, SQL Server, SQLite, PGlite, community
Migrations
Built-in Migrator, hand-written up/down files
Open source
Yes
Self-host
Yes
EU data
Not stated
Category
ORMs
Visit kysely.dev ↗

To report an out-of-date price or limit, use the correction form.

whichdevtool?

Developer and cloud tools compared on price, free tier and limits, each with its source. For side projects, solo developers and small teams.

Categories

  • VPS and cloud servers
  • App hosting and PaaS
  • Managed databases
  • Transactional email APIs
  • Email marketing and newsletters
  • Domain registrars
  • CDN, DNS and edge security
  • Monitoring, uptime and error tracking
  • Auth and identity
  • Frontend and full-stack frameworks
  • Backend frameworks
  • UI component libraries
  • AI model APIs
  • File and object storage
  • Payments and billing
  • Background jobs, queues and workflows
  • ORMs and database toolkits

Research

  • Directory
  • Stacks by project
  • Developer news
  • Pricing changes
  • Glossary

Site

  • About and methods
  • How we make money
  • Suggest a tool or fix
  • Privacy
© 2026 whichdevtool.com Prices change. Each tool page links to its source. We may earn a commission when you sign up through links on this site. How we make money