The JSON-native TypeScript ORM
UQL (Unified Query Language) queries SQL databases and MongoDB with plain, type-safe JSON, in a syntax inspired by MongoDB's.
Website · Quick Start · Benchmark · Compare ORMs · Blog
npm install uql-orm pg # or mysql2, mariadb, better-sqlite3, mongodb, @tursodatabase/serverless, @libsql/client
That is the whole install (setup). No compiler flags and no reflect-metadata; the decorators are the TC39 standard spec, and plain classes work too, via defineEntity.
The compiler catches each of those, with no codegen: the entity classes are the schema. Try the editor on the home page.
Why UQL?
- Queries are JSON, not method chains. Build one dynamically, store it, or send it from the browser; the same object runs on every database. No DSL to learn.
- One API, everywhere it runs. PostgreSQL, PGlite, CockroachDB, MySQL, MariaDB, MSSQL, SQLite, Turso, libSQL, Neon, Cloudflare D1, Bun's native SQL, and even MongoDB. The same code on Node 24+, Bun, Deno, Cloudflare Workers, AWS Lambda and Vercel, and the browser, with no native binaries on the
fetch-based drivers. - Type-safe to the leaf, nothing to generate. Every key is checked against your entity, down into populated relations and JSON/JSONB dot-paths, so
$likeon a numeric column is a compile error. No.prismafile, no generated client. - Relations without N+1.
$populatereads a to-many inside the parent's statement, so a read is one round trip. Nothing is lazy, so nothing fires behind your back in a serializer. - Migrations you read before they run. Edit an entity, run
uql-migrate generate:entities, review the SQL in the PR like any other file.drift:checkcatches a database that no longer matches. - Raw SQL when you want it.
raw()fits anywhere in a query, computed fields are expressions you can filter on, and a migration can be plain SQL. - Light. Zero runtime dependencies and every dialect in one package, yet
uql-orm/postgresis about 27 kB gzipped. See what we deleted to get there. - The hard things are built in. Semantic and vector search, multi-tenant filters you cannot bypass by accident, soft-delete with restore, streaming, and a REST API from your entities.
- The fastest ORM. On a full PostgreSQL round trip it adds the least over hand-written driver code of any ORM in our open-source benchmark, on Bun, Node and Deno alike. The same benchmark scores the types by compiling ordinary mistakes in each ORM's API: UQL is the only one that catches them all.
Get started
uql-orm.dev has the full docs. Good places to start:
- Quick Start - install, define an entity, run a query
- Querying - operators, relations, aggregates, transactions
- Entities - decorators, relations, hooks, or the decorator-free imperative API
- Switching to UQL - coming from Prisma, Drizzle, TypeORM, or MikroORM
⭐ Like what we're doing? Give us a star
It is how other people find the project.