Configuration
Every option in nestjs-codegen.config.ts.
These are the same options you pass to NestjsCodegenModule.forRoot().
The module is the primary way to run the codegen in dev; this config file is what the
CLI loads for CI runs. Author it with defineConfig (the legacy
nestjs-inertia.config.ts name is still accepted), and import it into forRoot() to keep
a single source of truth.
forRoot() accepts two module-only fields on top of everything below: enabled
(boolean — defaults on outside NODE_ENV=production) and cwd (project root,
defaults to process.cwd()).
import { defineConfig } from '@dudousxd/nestjs-codegen';
import { valibotAdapter } from '@dudousxd/nestjs-codegen-valibot';
import { tanstackQuery } from '@dudousxd/nestjs-codegen-tanstack';
export default defineConfig({
contracts: { glob: 'src/**/*.controller.ts', debounceMs: 500 },
codegen: { outDir: 'src/generated', cwd: process.cwd() },
validation: valibotAdapter, // zodAdapter | valibotAdapter | arktypeAdapter
extensions: [tanstackQuery({ import: '@tanstack/vue-query' })],
forms: { enabled: true, watch: 'src/**/*.dto.ts' },
serialization: 'json', // 'json' (default) | 'superjson'
// ── Inertia only (omit for a plain NestJS API) ──────────────────
pages: { glob: 'resources/pages/**/*.tsx' },
app: { moduleEntry: 'src/app.module.ts', tsconfig: 'tsconfig.json' },
});Options
Prop
Type
The fetcher is no longer a config concern. The generated api.ts is a
createApi(fetcher) factory — you inject the fetcher (with its baseUrl, transport,
and transformer) at runtime. See API client.