Profile
Back to NewsBack
GitHub Trending 3 min
Reader Mode
rogerpadilla/uql: The JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, Node, Workers

rogerpadilla/uql: The JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, Node, Workers

4 hours ago

UQL

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

tests</a> Coverage Status</a> npm version</a> license</a>


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.

A UQL query being typed: the compiler underlines the misspelled 'emial', then 'titel' three levels deep inside $populate, then '$like' on a numeric column

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 $like on a numeric column is a compile error. No .prisma file, no generated client.
  • Relations without N+1. $populate reads 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:check catches 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/postgres is 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:

Release notes live in CHANGELOG.md.

⭐ Like what we're doing? Give us a star

It is how other people find the project.

Star UQL on GitHub</a>

Chat with me