Skip to content

CLI Overview

The drzl CLI analyzes Drizzle schemas and runs generators.

Quick help:

bash
pnpm dlx @drzl/cli --help
bash
npx @drzl/cli --help
bash
yarn dlx @drzl/cli --help
bash
bunx @drzl/cli --help

Jump to commands:

Commands & Options

analyze

Analyze a Drizzle schema (TypeScript) and output a normalized Analysis.

Usage (by package manager):

bash
pnpm dlx @drzl/cli analyze <schema> [--relations] [--validate] [--out FILE] [--json]
bash
npx @drzl/cli analyze <schema> [--relations] [--validate] [--out FILE] [--json]
bash
yarn dlx @drzl/cli analyze <schema> [--relations] [--validate] [--out FILE] [--json]
bash
bunx @drzl/cli analyze <schema> [--relations] [--validate] [--out FILE] [--json]

Options:

  • --relations (default true): include relation inference
  • --validate (default true): validate constraints
  • --out <file>: write JSON to file
  • --json (default false): print JSON to stdout (overrides --out)

Exits non‑zero when errors are found in issues.

generate

Run configured generators from drzl.config.*.

Usage:

bash
pnpm dlx @drzl/cli generate -c drzl.config.ts
bash
npx @drzl/cli generate -c drzl.config.ts
bash
yarn dlx @drzl/cli generate -c drzl.config.ts
bash
bunx @drzl/cli generate -c drzl.config.ts

Options:

  • -c, --config <path>: path to config file

Behavior:

  • Analyzes your schema
  • Runs each generator in generators[], printing a file summary per kind

generate:orpc

Quickly generate oRPC routers without a config.

Usage:

bash
pnpm dlx @drzl/cli generate:orpc <schema> -o src/api --template standard --includeRelations
bash
npx @drzl/cli generate:orpc <schema> -o src/api --template standard --includeRelations
bash
yarn dlx @drzl/cli generate:orpc <schema> -o src/api --template standard --includeRelations
bash
bunx @drzl/cli generate:orpc <schema> -o src/api --template standard --includeRelations

Options:

  • -o, --outDir <dir> (default src/api)
  • --template <name> (default standard) — can be standard or a custom path
  • --includeRelations — include relation endpoints

watch

Watch schema (and template paths) and regenerate on changes.

Usage:

bash
pnpm dlx @drzl/cli watch -c drzl.config.ts --pipeline all --debounce 200 [--json]
bash
npx @drzl/cli watch -c drzl.config.ts --pipeline all --debounce 200 [--json]
bash
yarn dlx @drzl/cli watch -c drzl.config.ts --pipeline all --debounce 200 [--json]
bash
bunx @drzl/cli watch -c drzl.config.ts --pipeline all --debounce 200 [--json]

Options:

  • -c, --config <path>
  • --pipeline <name>: all | analyze | generate-orpc (default all)
  • --debounce <ms>: debounce milliseconds (default 200)
  • --json: emit structured JSON logs

init

Scaffold a minimal drzl.config.ts in the current directory.

bash
pnpm dlx @drzl/cli init
bash
npx @drzl/cli init
bash
yarn dlx @drzl/cli init
bash
bunx @drzl/cli init

See also: