Skip to content

Configuration

DRZL reads a drzl.config.ts that describes your schema path and generators.

ts
import { defineConfig } from '@drzl/cli/config';

export default defineConfig({
  schema: 'src/db/schemas/index.ts',
  outDir: 'src/api',
  analyzer: { includeRelations: true, validateConstraints: true },
  generators: [
    { kind: 'zod', path: 'src/validators/zod', schemaSuffix: 'Schema' },
    {
      kind: 'service',
      path: 'src/services',
      dataAccess: 'drizzle',
      schemaImportPath: 'src/db/schema',
      databaseInjection: {
        enabled: true,
        databaseType: 'Database',
        databaseTypeImport: { name: 'Database', from: 'src/db/db' },
      },
    },
    {
      kind: 'orpc',
      template: '@drzl/template-orpc-service',
      includeRelations: true,
      naming: { routerSuffix: 'Router', procedureCase: 'kebab' },
      validation: { library: 'valibot' },
      databaseInjection: {
        enabled: true,
        databaseType: 'Database',
        databaseTypeImport: { name: 'Database', from: 'src/db/db' },
      },
      servicesDir: 'src/services',
    },
  ],
});

Config File Formats

DRZL accepts multiple config formats:

  • TypeScript: drzl.config.ts
  • ES Module: drzl.config.mjs
  • CommonJS: drzl.config.js
  • JSON: drzl.config.json

When using JSON, ensure it’s strict JSON (no comments/trailing commas). TS/JS configs can export either a default object or use defineConfig(...).

See package READMEs for generator‑specific options.