Vibeleaderboard
Index / tool
Visit kysely.dev
Category
Developer Tools
Rank
Pricing
Open Source
Type
TOOL
Use case
Coding
Interfaces
SDK
Builder
kysely-org
Latest release
v0.29.7
Date

About

Type-safe SQL query builder. Pure SQL query builder for TypeScript with full type inference from your schema. No ORM abstractions, just SQL with safety.

What it does

Kysely lets you build SQL queries from TypeScript, where the compiler checks every table and column reference against a schema interface you define once. Chained methods return only the fields you selected, correctly typed and aliased, with autocomplete guiding each step instead of an opaque object. It targets several relational engines, including Postgres, MySQL, SQL Server, and SQLite, through swappable dialect adapters, and stays close to how SQL itself reads rather than hiding it behind chained model objects. When the compiler cannot express a shape, a raw-fragment escape hatch covers the gap.

Why it's ranked here

Kysely declares zero runtime dependencies, and its contributor guidelines state that as a design rule rather than an accident, a stricter bar than most query builders hold themselves to. It ships adapters for five relational databases in one package, a plugin system for cross-cutting concerns like key casing and null handling, and a migration module kept separate from the core query API. The public interface re-exports dozens of narrowly scoped builder and compiler pieces instead of one large class, reading as a library organized around composability rather than a single opinionated pipeline built for one workflow.

What's good

Escape hatches are treated as a first-class feature rather than an afterthought: a raw SQL tag and a dynamic reference builder both let you step outside the type system for the rare case it cannot express, without losing type safety everywhere else in the same query. The library also ships a readonly variant of its core interface, useful when a connection should only ever be allowed to read. Its own contribution guidelines describe testing policy as functionality tests run against real database instances with no mocks, plus dedicated type-level tests, an unusually rigorous bar for a library this size to hold itself to.

Tradeoffs

Node 22 or newer is required, which will exclude projects still pinned to older long-term-support releases. The core package favors thin, close-to-SQL primitives over convenience: there is no built-in object mapping or relation loading, so anything resembling an active-record pattern or eager-loading has to be built by hand or pulled in from a separate tool. The maintainers' own contribution process is deliberately slow and gated behind an existing accepted issue, which supports stability but means an unrequested feature can sit unaddressed for a while even with a working patch attached.

How to use it well

Reach for this when a project already knows its SQL and wants the compiler to keep query code honest as the schema evolves, across Postgres, MySQL, SQL Server, or SQLite without switching tooling per database. It suits teams comfortable writing joins and subqueries by hand rather than teams that want a data layer to generate that SQL for them automatically. Pair it with a separate schema-introspection tool to derive the interface from an existing database, and reach for the plugin system when you need consistent casing or null handling across every query rather than solving it one query at a time.

Technical notes+

The package entry point (src/index.ts) re-exports dialect adapters for sqlite, mysql, postgres, mssql, and pglite, plus a separate migration module (src/migration/index.ts, exporting a file-based migration provider and a migrator) and a readonly module (src/readonly/index.ts) mirroring the main query interface but omitting mutating query builders. package.json declares no dependencies key at all, only devDependencies, sets engines.node to >=22.0.0, type: module for ESM-only output, and an exports map exposing per-dialect helper subpaths (./helpers/mssql, ./helpers/mysql, ./helpers/postgres, ./helpers/sqlite) alongside ./migration and ./readonly. example/src/app.ts is a sample Koa integration showing PostgresDialect wired to a pg Pool; it is not part of the published package's files list. CONTRIBUTING.md states the zero-dependency and full-database-testing-with-no-mocks rules explicitly, and documents an issue-first, assignment-gated pull request process; it also contains pointed anti-LLM-slop language aimed at contributors, unrelated to any instruction directed at this review.

Observed

License
MIT licensed, per the package manifest.
Packaging
Published as ESM only (type: module in the package manifest), with no CommonJS build.
Dependencies
Package manifest lists no runtime dependencies, only devDependencies.
Platform support
Package manifest requires Node.js 22 or newer via engines.node.
Dialect support
Ships dialect adapters for PostgreSQL, MySQL, SQL Server (MSSQL), SQLite, and PGlite as documented subpath exports.
Interfaces
Distributed as a library for import into code, not a command-line tool; the manifest defines no bin entry.
Packaging
Includes a dedicated migration module and a readonly-mode module as separate package subpath exports.
Packaging
The published files list in the manifest includes only the compiled dist directory and a type-compatibility shim, not the source or test trees.

Read from README.md, package.json, src/index.ts, src/migration/index.ts, src/readonly/index.ts, example/src/app.ts, CONTRIBUTING.md.

Tags

ORM & Data LayerKysely

Tech Stack

Node.jsTypeScript

Media

Kysely

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.