A list of query-builders and other SQL query and/or schema abstractions.
Libraries with no activity for 2+ years will be considered "dead", as these are not keeping up with the language or ecosystem - but they may be added and may remain on the list, if they contain different or interesting ideas.
from(books).where(books.author.lower().like('%bob')
and similar.
- https://github.com/phiresky/ts-typed-sql - PG only, looks dead
- https://github.com/ClickerMonkey/typed-query-builder - PG/MS-SQL/SQL, looks dead
- https://github.com/ggmod/type-sql - PG/MySQL, looks dead
- https://github.com/hoeck/typesafe-query-builder - PG, looks dead
- https://github.com/sloanelybutsurely/dahlia - PG, run-time validation, looks dead
- https://github.com/SaveliyP/ts-typed-sql - looks dead
- https://github.com/seamapi/quackatos - PG, based on ZAPATOS, design-time code generation from schema
- https://github.com/danvk/crudely-typed - PG, based on
pg-to-ts
, design-time code generation from schema - https://github.com/prisma/prisma - PG/MySQL/MS-SQL/SQLite, generates schema and code from a custom DSL
- https://github.com/drizzle-team/drizzle-orm - PG/MySQL/MS-SQL/SQLite, no code generation required
- https://github.com/benmerckx/rado - SQLite, no code generation required
- https://github.com/ForbesLindesay/atdatabases - PG, generates types from schema
Literal SQL or primarily SQL fragments.
sql`SELECT * FROM books WHERE author LIKE '%bob%`
and similar.
- https://github.com/JasonShin/sqlx-ts - PG/MySQL, alive, generates types from schema at design-time
- https://github.com/Schniz/cuery - PG/MySQL, ⭐ interesting approach to type-safety via callbacks in string templates, looks dead
- https://github.com/ts-safeql/safeql - PG, ⭐ type-safe with auto-completions
- https://github.com/akheron/sqltyper - PG, code generation from
.sql
files - https://github.com/adelsz/pgtyped - PG, code generation from
.sql
files - https://github.com/gajus/slonik - PG, run-time and build-time type-checked
- https://github.com/porsager/postgres - PG, limited TS support
Fluent query-builders with SQL fragments.
from(books).where(`{books.author} LIKE '%bob%'`)
and similar.
- https://github.com/terkelg/sqliterally - PG/MySQL, ⭐ type-safe? (looks dead)
- https://github.com/kysely-org/kysely - PG/MySQL/SQLite
External tools to validate literal inline SQL.
- https://github.com/gajus/eslint-plugin-sql - PG, type-checks literal SQL via
eslint
Uses (mutable) entities as opposed to plain objects/records, and ORM patterns such as Active Record (AR) or level 1 caching, etc.
- https://github.com/typeorm/typeorm - PG/MySQL/SQLite/MS-SQL, AR and data-mapper options, fluent query-builders
- https://github.com/mikro-orm/mikro-orm - PG/MySQL/SQLite, unit-of-work, fluent query-builders, data-mapping
- https://github.com/twinlogix/typetta - PG/MySQL/MS-SQL/SQLite, AR style, code generation from GraphQL
- https://github.com/sequelize/sequelize - PG/MySQL/SQLite/MS-SQL, AR style, attribute-driven, v7 (alpha) appears to provide more first-class TS support