Cross-platform SQL editor and database manager for Linux, macOS, and Windows, supporting MySQL, PostgreSQL, SQLite, SQL Server and many more.
kysely-org/kysely
A type-safe TypeScript SQL query builder that autocompletes tables, columns and result types across SQL databases.
- Stars
- 14,294
- Forks
- 452
- Open issues
- 187
- Last commit
- 4 hours ago
What is it?
Kysely is a SQL query builder for TypeScript. You write queries with a chainable API, and the TypeScript compiler tracks which tables and columns are visible at each step, so the result row type reflects exactly the selected columns, including aliases and types from subqueries, joins and with statements.
It is mainly aimed at Node.js but also runs on Deno, Bun, Cloudflare Workers and in web browsers. Dialects are provided for PostgreSQL, MySQL, Microsoft SQL Server, SQLite and PGlite. Kysely is inspired by Knex.js and sits at the query-builder level rather than as a full ORM.
Where types cannot be inferred at compile time, it offers an sql template tag and a dynamic module as escape hatches. API documentation is embedded in the typing files, so it shows up on hover in an IDE.
Key features
- 01Compile-time checking of table and column references in queries.
- 02Result types that follow selected columns, aliases and subqueries.
- 03Dialects for PostgreSQL, MySQL, MSSQL, SQLite and PGlite.
- 04Runs on Node.js, Deno, Bun, Cloudflare Workers and browsers.
- 05An sql template tag for cases the type system cannot express.
Use cases
- Building type-safe data access layers in a TypeScript backend.
- Writing complex queries with joins and subqueries while keeping result types accurate.
- Using one query builder across PostgreSQL, MySQL or SQLite projects.
- Running database queries in edge runtimes such as Cloudflare Workers.
Quick start
- 1
Visit the documentation site kysely.dev to get started
Topics
FAQ
- What is kysely?
- A type-safe TypeScript SQL query builder that autocompletes tables, columns and result types across SQL databases. Kysely is a SQL query builder for TypeScript. You write queries with a chainable API, and the TypeScript compiler tracks which tables and columns are visible at each step, so the result row type reflects exactly the selected columns, including aliases and types from subqueries, joins and with statements.
- Is kysely free to use? What license does it have?
- kysely is open source under the MIT license. Check the license terms before using it in commercial products.
- Is kysely still maintained?
- Actively maintained. The last commit to kysely was on Oct 21, 2026.
- What can I use kysely for?
- Building type-safe data access layers in a TypeScript backend. Writing complex queries with joins and subqueries while keeping result types accurate. Using one query builder across PostgreSQL, MySQL or SQLite projects. Running database queries in edge runtimes such as Cloudflare Workers.
- How do I install kysely?
- Visit the documentation site kysely.dev to get started
- Where can I get kysely?
- The source code and installation instructions are on GitHub: https://github.com/kysely-org/kysely
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
TypeScript ORM for Node.js that gives type-safe database access across PostgreSQL, MySQL, SQLite, MongoDB and other databases.
A TypeScript and JavaScript ORM for Node.js and other JS platforms, supporting both Active Record and Data Mapper patterns across many SQL and NoSQL databases.
A lightweight, headless TypeScript ORM for PostgreSQL, MySQL and SQLite that works across Node.js, Bun, Deno and edge runtimes.
A promise-based Node.js and TypeScript ORM for PostgreSQL, MySQL, MariaDB, SQLite, MS SQL Server, Snowflake, Oracle and Db2.
Async, pure Rust SQL toolkit with compile-time checked queries written as plain SQL, supporting PostgreSQL, MySQL/MariaDB, and SQLite.