# kysely-org/kysely

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/kysely-org-kysely).**

13,969 stars · 419 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/kysely-org/kysely
- Homepage: https://kysely.dev
- awesome-repositories: https://awesome-repositories.com/repository/kysely-org-kysely.md

## Description

Kysely is a TypeScript SQL query builder that provides a type-safe interface for constructing and executing database queries. It functions as a database layer that ensures schema compliance and prevents runtime errors by using a fluent interface and a programmable way to build complex SQL statements.

The project features a type-safe database layer capable of inferring return types and aliases from SQL selections and joins. It also includes a SQL migration manager to track and apply schema changes across different environments to keep database versions synchronized.

The toolkit covers relational database integration through dynamic query construction and the execution of raw SQL statements. It allows for the creation of parameterized SQL snippets and the ability to reference tables and columns dynamically at runtime.

## Tags

### Data & Databases

- [Type-Safe Database Clients](https://awesome-repositories.com/f/data-databases/type-safe-database-clients.md) — Functions as a type-safe database layer that infers return types and aliases from SQL selections and joins.
- [Type-Safe Query Builders](https://awesome-repositories.com/f/data-databases/type-safe-query-builders.md) — Provides a type-safe query builder that ensures database schema compliance at compile time. ([source](https://github.com/kysely-org/kysely/tree/master/example))
- [Dynamic SQL Generators](https://awesome-repositories.com/f/data-databases/dynamic-sql-generators.md) — Builds SQL statements at runtime based on variable inputs while maintaining type safety.
- [Fluent Query Builders](https://awesome-repositories.com/f/data-databases/fluent-query-builders.md) — Implements a chainable, functional interface for constructing complex SQL queries programmatically.
- [Relational Database Connectors](https://awesome-repositories.com/f/data-databases/relational-database-connectors.md) — Connects TypeScript applications to relational databases using a fluent interface for data management.
- [Schema Mapping Utilities](https://awesome-repositories.com/f/data-databases/schema-mapping-utilities.md) — Maps TypeScript interfaces to database table structures to provide compile-time validation of schema types.
- [SQL Query Builders](https://awesome-repositories.com/f/data-databases/sql-query-builders.md) — Provides a type-safe interface for constructing and executing SQL queries to ensure schema compliance.
- [Fluent Interfaces](https://awesome-repositories.com/f/data-databases/sql-query-interfaces/fluent-interfaces.md) — Provides a fluent interface for building complex, type-safe SQL queries through method chaining.
- [Dynamic Column References](https://awesome-repositories.com/f/data-databases/column-mappings/dynamic-column-references.md) — Identifies database columns using names provided at runtime to build queries based on user input. ([source](https://kysely-org.github.io/kysely-apidoc/classes/DynamicModule.html))
- [Parameterized SQL Templates](https://awesome-repositories.com/f/data-databases/data-querying/sql-templating-engines/parameterized-sql-templates.md) — Uses tagged templates to separate raw SQL from user values to prevent SQL injection attacks.
- [Database Migrations](https://awesome-repositories.com/f/data-databases/database-migrations.md) — Includes a migration manager to track and apply schema changes across different environments. ([source](https://github.com/kysely-org/kysely/blob/master/jsr.json))
- [Migration Management](https://awesome-repositories.com/f/data-databases/migration-management.md) — Includes a migration manager to track and apply schema changes across different environments.
- [Raw SQL Execution](https://awesome-repositories.com/f/data-databases/raw-sql-execution.md) — Allows the execution of manual SQL statements for complex scenarios that exceed the query builder's capabilities. ([source](https://github.com/kysely-org/kysely#readme))
- [Parameterized SQL Snippets](https://awesome-repositories.com/f/data-databases/raw-sql-execution/parameterized-sql-snippets.md) — Creates parameterized SQL fragments using template tags to prevent security vulnerabilities like injection. ([source](https://kysely-org.github.io/kysely-apidoc/interfaces/Sql.html))
- [SQL Dialect Adapters](https://awesome-repositories.com/f/data-databases/sql-dialect-adapters.md) — Provides a driver-agnostic layer that adapts SQL syntax across different database engines through a unified API.
- [Dynamic Table References](https://awesome-repositories.com/f/data-databases/virtual-table-querying/dynamic-table-references.md) — Identifies database tables using names provided at runtime to select specific tables within a query. ([source](https://kysely-org.github.io/kysely-apidoc/classes/DynamicModule.html))

### Software Engineering & Architecture

- [Query Result Type Inference](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/dynamic-return-type-inference/query-result-type-inference.md) — Calculates exact return types and aliases for queries by analyzing selected columns and join operations.

### Programming Languages & Runtimes

- [Dynamic SQL Expressions](https://awesome-repositories.com/f/programming-languages-runtimes/expression-evaluators/dynamic-sql-expressions.md) — Allows referencing database columns and tables dynamically at runtime while maintaining a structured query object.

### Part of an Awesome List

- [Databases and Data Tools](https://awesome-repositories.com/f/awesome-lists/data/databases-and-data-tools.md) — Type-safe SQL query builder for TypeScript.
- [Search and Databases](https://awesome-repositories.com/f/awesome-lists/data/search-and-databases.md) — Builds type-safe SQL queries.
