Skip to main content

Duck Gen

Scans your TypeScript server code and emits .d.ts files so client types stay locked to your backend routes and message keys.

6 capabilities

Your backend is the source of truth

Duck Gen reads your server code and emits typed route and message modules. No duplicate OpenAPI schemas. No drift between client and production endpoints.

Route scanning

Walks your NestJS / TypeScript server modules and extracts every route (verbs, params, bodies, responses) into one type graph.

Emit .d.ts

Generates declaration files your client imports directly. No runtime, no codegen DSL. Typed modules out.

Message keys

Scans i18n catalogs and emits unions of valid keys. Typos fail at compile time instead of silently at runtime.

Zero runtime

Ships as a CLI. Nothing lands in your bundle. Emitted types are plain .d.ts files erased at build time.

Watch mode

Re-generates on file changes. Keep duck-gen running next to your dev server and client types track the backend live.

Schema export

Ships `duck-gen.schema.json` for editor validation of your config. Autocomplete and hover docs come with it.

Install

Works with NestJS today. Express and Fastify support is next.

# Install
bun add -D @gentleduck/gen

# Generate types
bunx duck-gen

Free & open source

gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.

Become a Sponsor