Getting started

Installation

Install drizzle-resource and check that your Drizzle setup has what the engine needs.

Requirements

  • Drizzle ORM >=1.0.0-rc.5 with relational queries enabled, so db.query.<table>.findMany(...) exists.
  • Your schema and relations, defined with defineRelations or defineRelationsPart.
  • TypeScript with strict: true for the most precise field-path types.

Install

bun add drizzle-resource

Request and response validators are separate entry points of the same package: drizzle-resource/zod, drizzle-resource/valibot and drizzle-resource/vine. Install the validator you already use; see Validation.

What the engine needs

import { 
createQueryEngine
} from "drizzle-resource";
const
engine
=
createQueryEngine
({
db
, // your Drizzle database instance
schema
, // your tables, keyed by name
relations
, // your Drizzle relations
});
OptionUsed for
dbRunning the queries. Row loading uses Drizzle's relational query API.
schemaDeriving field paths and their types, compiling filters and sorting, reading unique constraints.
relationsFollowing relation paths such as customer.name and building joins.

The package ships its own types; there is no @types package to install.

Next: define your first resource.

Copyright © 2026