Skip to content
How-to guides

Installation

Install Kubb, the plugins your output needs, and verify the CLI.

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 typescript

Install 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

Terminal
npx kubb --version

Use 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.

Terminal
npx kubb init

Then run npx kubb generate. Kubb writes the generated files to output.path.

See also