Kysely

Type-safe SQL query builder for TypeScript that provides composable, dialect-aware query construction without ORM abstractions, supporting PostgreSQL, MySQL, SQLite, and community dialects.

Evaluated Mar 06, 2026 (0d ago) v0.27.x
Homepage ↗ Repo ↗ Developer Tools typescript sql query-builder postgresql mysql sqlite type-safe
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
86
/ 100
Is it safe for agents?
⚡ Reliability
79
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
84
Auth Simplicity
98
Rate Limits
95

🔒 Security

TLS Enforcement
88
Auth Strength
88
Scope Granularity
82
Dep. Hygiene
88
Secret Handling
86

All builder-generated queries use parameterized values preventing SQL injection; sql template tag requires manual care; minimal dependency footprint reduces supply chain risk

⚡ Reliability

Uptime/SLA
82
Version Stability
78
Breaking Changes
75
Error Recovery
82
AF Security Reliability

Best When

Writing data-access code in TypeScript where full SQL expressiveness is required alongside compile-time column and type safety without the overhead of a full ORM.

Avoid When

The project needs an integrated migration runner, schema-first code generation, or relation-level eager loading built into the query layer.

Use Cases

  • Build complex dynamic SQL queries with full TypeScript type inference on table columns and join results
  • Compose reusable query fragments (subqueries, CTEs, conditional where clauses) in a type-safe way across a large codebase
  • Use as the query layer in a custom data-access architecture where ORM conventions are unwanted
  • Migrate from Knex.js to a type-safe alternative with near-identical query builder ergonomics
  • Integrate with edge runtimes via community dialects (Cloudflare D1, PlanetScale, Neon) without a large binary dependency

Not For

  • Projects that need automatic migrations, schema management, or an ORM-level relations API out of the box
  • Teams unfamiliar with SQL who want high-level active-record-style finders generated from a schema definition
  • Applications targeting databases beyond SQL (e.g., MongoDB, Redis) which Kysely does not support

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Library with no network auth layer; credentials are passed to the underlying driver (pg, mysql2, better-sqlite3) during Kysely instantiation

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Completely free and open source with no commercial tier

Agent Metadata

Pagination
offset
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • Kysely is pre-1.0 and makes occasional breaking API changes; pin exact versions in agent-managed projects
  • No built-in migration system — agents must pair Kysely with a separate migration tool like kysely-migrate or raw SQL files
  • Type inference depends on a Database interface that must be kept manually in sync with the actual schema
  • sql template tag bypasses type checking and can silently produce invalid SQL if used carelessly
  • Community dialects (D1, Neon, PlanetScale) vary in maturity and may not support all Kysely features

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Kysely.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered