Focused query-builder extensions and SQL helpers for Drizzle ORM.
drizzle-plus adds practical query methods such as count(), upsert(),
updateMany(), and cursor pagination. It also provides typed SQL expressions
for common functions, JSON aggregation, timestamps, subqueries, and more.
It supports PostgreSQL, MySQL, and SQLite. The documentation has one page for each extension and helper family, with the supported import path and a working starting example.
pnpm add drizzle-plus drizzle-ormThe package targets the Drizzle ORM v1 line and declares drizzle-orm as a
peer dependency. Keep both packages on compatible versions.
Query extensions are enabled with a dialect-specific side-effect import:
import 'drizzle-plus/sqlite/findManyAndCount'
const page = await db.query.user.findManyAndCount({
where: { active: true },
columns: { id: true, name: true },
limit: 20,
})
page.data
page.countUse pg, mysql, or sqlite in the import path that matches your Drizzle
database. Shared SQL helpers are named imports:
import { caseWhen, upper } from 'drizzle-plus'
import { jsonAgg } from 'drizzle-plus/pg'- Create rows
- Upsert rows
- Update many rows
- Count rows
- Find a unique row
- Find many and count
- Cursor pagination
- Query composition
- Build selections with
$select() - Build
VALUESrelations with$values() - Use queries as subqueries with
.as() - Build recursive CTEs
- Control PostgreSQL CTE materialization
- Omit table columns with
$without() - Keep one base row with
fromSingle() - Select expressions without
FROM
- Conditional expressions
- Scalar subqueries
- SQL value coercion
- Universal SQL functions
- Dialect-specific SQL functions
- Database timestamps
- Require a result with
orThrow() - Merge query options
- Convert plain values with
toSelection() - Derived types
pnpm test
pnpm run lint
pnpm run docs:buildContributions are welcome. See the full documentation for feature boundaries and dialect support.
MIT