Getting Started
Get up and running in seconds — no global installs required.
Prereqs
- Node.js ≥ 18.17 (LTS or newer)
- A Drizzle schema (TypeScript)
- Install the CLI
Add DRZL CLI to your project (no globals needed):
bash
pnpm add -D @drzl/clibash
npm i -D @drzl/clibash
yarn add -D @drzl/clibash
bun add -d @drzl/cli- One complete example (oRPC + Zod + Service)
Add a single config to generate Zod validators and oRPC routers that reuse them, plus typed services:
ts
// drzl.config.ts
import { defineConfig } from '@drzl/cli/config';
export default defineConfig({
schema: 'src/db/schemas/index.ts',
outDir: 'src/api',
generators: [
// 1) Zod validators
{ kind: 'zod', path: 'src/validators/zod', schemaSuffix: 'Schema' },
// 2) Routers (oRPC adapter), reusing Zod schemas
{
kind: 'orpc',
template: '@drzl/template-orpc-service',
includeRelations: true,
outputHeader: { enabled: true },
validation: {
useShared: true,
library: 'zod',
importPath: 'src/validators/zod',
schemaSuffix: 'Schema',
},
},
// 3) Typed services (Drizzle-aware or stub)
{
kind: 'service',
path: 'src/services',
dataAccess: 'drizzle', // or 'stub'
dbImportPath: 'src/db/connection',
schemaImportPath: 'src/db/schemas',
},
],
});- Install Templates
The CLI comes with all the generators you need. You only need to install any templates you want to use. For this example, we'll install the oRPC service template:
bash
pnpm add -D @drzl/template-orpc-servicebash
npm i -D @drzl/template-orpc-servicebash
yarn add -D @drzl/template-orpc-servicebash
bun add -d @drzl/template-orpc-service- Generate:
bash
pnpm dlx @drzl/cli generate -c drzl.config.tsbash
npx @drzl/cli generate -c drzl.config.tsbash
yarn dlx @drzl/cli generate -c drzl.config.tsbash
bunx @drzl/cli generate -c drzl.config.tsThis writes validators to src/validators/zod, routers to src/api, and services to src/services.
Notes
- Router generation is adapter‑based (currently oRPC). Additional adapters (tRPC, Express, NestJS, Next.js, Prisma, etc.) can be added via templates.
- For Zod/Valibot/ArkType or Service generators, install the matching package in your app (as shown above).
- Config file formats supported:
drzl.config.ts,.mjs,.js,.json.
Next steps
- CLI commands → /cli
- Config reference → /guide/configuration
- Adapters → /adapters/overview

