Installation
Install Kubb in an existing project. To learn generation with a supplied specification and expected output, follow Generate your first client instead.
Prerequisites
- Node.js 22 or higher.
- TypeScript 5 or higher if you use a TypeScript config or import generated types.
Install Kubb and your plugins
kubb ships the CLI, the core runtime, the OpenAPI adapter, and the TypeScript, TSX, and Markdown parsers. Each output comes from its own plugin package, so install only the plugins you need. This example adds the TypeScript plugin:
pnpm add -D kubb @kubb/plugin-ts typescriptnpm install -D kubb @kubb/plugin-ts typescriptyarn add -D kubb @kubb/plugin-ts typescriptbun add -d kubb @kubb/plugin-ts typescriptInstall the runtime libraries your output needs too. An Axios client uses axios, and React Query hooks use react and @tanstack/react-query. Each plugin page lists its requirements.
Verify the installation
npx kubb --versionUse pnpm exec kubb, yarn kubb, or bunx kubb with the matching package manager.
Create a config
Run the initialization wizard to choose your specification, output directory, and plugins, or write kubb.config.ts yourself with one of the stacks.
npx kubb initThen run npx kubb generate. Kubb writes the generated files to output.path.
See also
- Generate your first client: a complete example with a supplied specification
- Configuration reference: every option and default