Zero‑friction codegen for Drizzle ORM. Analyze your schema. Generate validation, services, and routers fast.
- GitHub Sponsors: https://github.com/sponsors/omar-dulaimi
- Want something prioritized? Look for issues labeled
sponsor-wanted(or open one) and DM @omardulaimidev so we can reserve it for you. - Custom template/generator/adapter requests happen via X DM. Paid work ships back into DRZL so everyone benefits.
- Analyzer: turns Drizzle schemas into a normalized analysis model
- Generators: Zod, Valibot, ArkType, TypeBox and Effect Schema validation; JSON Schema and OpenAPI;
typed CRUD services; and routers for oRPC, tRPC, Hono, Express, Fastify, NestJS and GraphQL.
Fourteen in all, and installing
@drzl/clibrings every one of them - Batteries: formatting, naming, reusable/shared schemas, relation support
- Monorepo: pnpm workspace, lockstep releases with Changesets
Postgres in-process via PGlite, SQLite via node:sqlite, and MySQL as a CI service container, on
every commit. The run behind this README printed:
1476 probes against a real Postgres (41 columns)
59 CHECK probes against a real Postgres (15 constrained columns)
rows Postgres rejects and the validator accepts: DRZL 0, drizzle-orm 24
32 CHECK probes against a real SQLite (10 constrained columns)
37 probes against a real MySQL
Those lines are compared against the run itself, line by line, by
scripts/verify/stages/35-docs-numbers.sh, so a number here that stops being true fails the build
rather than sitting in a README nobody rechecks. See how it is
verified.
- Install the CLI and init a config
pnpm add @drzl/cli -D
pnpm drzl init- Generate code
pnpm drzl generate -c drzl.config.tsMinimal config
// drzl.config.ts
import { defineConfig } from '@drzl/cli/config';
export default defineConfig({
schema: 'src/db/schemas/index.ts',
outDir: 'src/api',
generators: [
{ kind: 'zod', path: 'src/validators/zod' },
{ kind: 'service', path: 'src/services', dataAccess: 'drizzle' },
{ kind: 'orpc', template: '@drzl/template-orpc-service' },
],
});Runtime
- ESM / ES2021 output
- Node ≥ 22 for the
drzlCLI, which is what its own dependencies require - Node ≥ 18.17 for the generator and template libraries, if you call them directly
packages/analyzer: schema analysispackages/cli: CLI (drzl)packages/generator-orpc: oRPC router generatorpackages/generator-trpc: tRPC v11 router generatorpackages/generator-hono: Hono route generatorpackages/generator-express: Express 5 router generatorpackages/generator-fastify: Fastify 5 plugin generatorpackages/generator-nestjs: NestJS DTO and entity class generatorpackages/generator-graphql: GraphQL SDL and resolver-stub generatorpackages/generator-service: typed service generatorpackages/generator-zod: Zod generatorpackages/generator-valibot: Valibot generatorpackages/generator-arktype: ArkType generatorpackages/generator-typebox: TypeBox generatorpackages/generator-effect: Effect Schema generatorpackages/generator-json-schema: JSON Schema and OpenAPI generatorpackages/validation-core: shared validation utilitiespackages/template-orpc-service: oRPC router template (service‑backed)packages/template-standard: minimal oRPC router template
See each package’s README for details.
- Install:
pnpm install - Build:
pnpm -r run build - Test:
pnpm -r test - Lint:
pnpm lint
Runnable applications live in examples/. They are workspace members that depend on the
workspace copy of @drzl/cli, so pnpm build and pnpm -r test cover them and a regression in a
generator breaks them.
examples/nextjs-server-actions: a Drizzle schema,drzl generate, and the emitted zod schemas validating what a form posts to a Next.js server action, with field errors attributed to the constraint that caused them.
VitePress site lives in docs/ (kept out of releases). Local dev:
pnpm -C docs dev- None yet. Be the first! If you need a template, generator, or adapter that doesn’t exist yet, DM me on X (https://x.com/omardulaimidev) and we can scope a sponsored build. Funded work lands in this repo under Apache‑2.0 so everyone benefits.
Contributions welcome. See CONTRIBUTING.md.
Apache-2.0
