Aviary

CLI

The codegen, init, and doctor commands.

npx nestjs-codegen <command>

In dev, prefer NestjsCodegenModule.forRoot() — it starts the codegen with your app, no separate process. The CLI is for CI: a watch-free run that fails the build if the committed client has drifted before you deploy.

codegen

Discover controllers/pages and emit the generated files. Reads nestjs-codegen.config.ts.

npx nestjs-codegen codegen           # one-shot
npx nestjs-codegen codegen --watch   # regenerate on file changes

The watcher debounces and holds a lock file so two watchers don't fight over the output directory.

init

Scaffold a starter nestjs-codegen.config.ts (and, for Inertia projects, the app entry + page wiring).

npx nestjs-codegen init

doctor

Diagnose a project's setup — missing config, unscanned controllers, output drift — and print suggested fixes.

npx nestjs-codegen doctor

The TypeScript config (nestjs-codegen.config.ts) is loaded natively on modern Node (>= 22.18 / 23.6 / 24 / 25), which strips TypeScript types on import — so no extra tooling is needed, including on Node 25. On older Node without native type stripping the loader falls back to tsx (an optional peer); install it if you see a config-loading error: pnpm add -D tsx.

On this page