Kubb is an MIT-licensed TypeScript meta framework for code generation that turns an OpenAPI schema into type-safe TypeScript types, HTTP clients, data-fetching hooks, validators, and mocks for front-end and full-stack developers.
What it is
Kubb is a modular, plugin-based code generation engine written in TypeScript and published under the MIT licence. Its own description calls it "the meta framework for code generation": the core reads an API description and delegates output to plugins, so one schema can produce TypeScript types, HTTP clients, hooks, runtime validators, mock data, and mock service handlers. Input is read through adapters, with @kubb/adapter-oas as the documented option covering OpenAPI 2.0, 3.0, and 3.1, and the topic list pairs openapi and swagger with generators for zod, axios, and zodios.
The problem it solves is the manual gap between an API contract and the TypeScript code a client needs. Without generation, every schema change has to be carried by hand into interfaces, request functions, query hooks, validators, and mocks, and drift between server and client surfaces as runtime failures rather than compile errors. Kubb closes that gap in a single pass, and it replaces hand-maintained versions of each of those artefacts. It lives in the JavaScript and TypeScript ecosystem, with output targeted at Node.js and Bun, and its plugin catalogue ships from the separate kubb-labs/plugins repository while the engine itself is kubb-labs/kubb.
Key capabilities
- Generates TypeScript types, type-safe clients, TanStack Query and SWR hooks, Zod validators, Faker mocks, and MSW handlers from a single schema.
- Emits a typed axios or Fetch client with status-keyed results, auth, validation, file uploads, server-sent events, interceptors, and a swappable transport.
- Reads OpenAPI 2.0, 3.0, and 3.1 through adapters such as
@kubb/adapter-oas, with output for Node.js and Bun.
- Enables only the plugins a project needs:
plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-swr, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-redoc, and plugin-mcp.
- Shapes output by grouping files by tag, including or excluding operations, and writing to disk, memory, or a custom storage backend.
- Exposes the
kubb/kit authoring toolkit for custom plugins, generators, adapters, and renderers, plus a JSX renderer for component-based output.
- Integrates with bundlers via
unplugin-kubb for Vite, Nuxt, Astro, and webpack, and drives generation from AI tools over a built-in MCP server for Claude and Cursor, or inside Claude Code.
Who uses it and how
- Front-end teams that consume an OpenAPI contract and want generated hooks instead of hand-written data-fetching code; topics cover React, Vue, Svelte, and Solid alongside
react-query and swr.
- Teams that want mocks and validation from the same source of truth, using
plugin-faker and plugin-msw.
- Developers who generate during the build, running
unplugin-kubb inside Vite, Nuxt, Astro, or webpack rather than as a separate step.
- AI-assisted workflows, where the MCP server lets Claude, Cursor, or Claude Code trigger generation.
- Plugin and toolkit authors extending the engine with
kubb/kit.
Getting started
Install the package with bun add kubb, pnpm add kubb, or npm install kubb. Then run npx kubb init, which creates package.json when needed, guides plugin selection, installs packages, and writes kubb.config.ts, before npx kubb generate produces the code.
How it compares
No comparable projects are named in this registry entry, and no list of paid products that Kubb replaces is provided here. It therefore stands alone in this registry listing, and any comparison should be drawn from the project's own documentation at kubb.dev rather than from the facts recorded on this page.
When to use it โ and when not to
Kubb is a build-time dependency, so a self-hoster does not operate a database, object storage, or SMTP service, but must already hold an OpenAPI description and decide where generated output is written and kept. It is a poor fit for teams that do not maintain an OpenAPI or Swagger description, or that do not work in TypeScript, since the generated artefacts are TypeScript. Two caveats are visible in the facts: development is funded entirely by sponsors, and the plugin catalogue lives in a separate repository, so plugin availability and maintenance track that project rather than the core engine.
project readme (upstream, from github) โ read inline
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Stars][stars-src]][stars-href]
[![License][license-src]][license-href]
[![Coverage][coverage-src]][coverage-href]
[![Node][node-src]][node-href]
[![OC Backers][oc-backers-src]][oc-backers-href]
Kubb
The meta framework for code generation
Point Kubb at a schema and it generates types, clients, hooks, validators, mocks, and more.
Installation
bun add kubb
# or
pnpm add kubb
# or
npm install kubb
Quick start
Run the setup wizard to create a kubb.config.ts:
npx kubb init
The wizard creates a package.json if needed, guides you through plugin selection, installs packages, and writes kubb.config.ts. Then generate your code:
npx kubb generate
See the documentation for detailed usage and advanced features.
Features
- Generate TypeScript types, type-safe clients, TanStack Query and SWR hooks, Zod validators, Faker mocks, and MSW handlers from one schema.
- Generate a typed axios or Fetch client with status-keyed results, auth, validation, file uploads, server-sent events, interceptors, and a swappable transport.
- Read OpenAPI 2.0, 3.0, and 3.1 through adapters like
@kubb/adapter-oas, with output for Node.js and Bun.
- Enable only the plugins you need:
plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-swr, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-redoc, plugin-mcp.
- Shape the output by grouping files by tag, including or excluding operations, and writing to disk, memory, or a custom storage backend.
- Build your own plugins, generators, adapters, and renderers with the
kubb/kit authoring toolkit, plus a JSX renderer for component-based output.
- Run generation in your bundler with
unplugin-kubb for Vite, Nuxt, Astro, webpack, and more.
- Drive generation from AI tools over the built-in MCP server (Claude, Cursor) or inside Claude Code.
Supporting Kubb
Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
Contributing
We welcome contributions that help improve Kubb. A few ways to get involved:
See CONTRIBUTING.md for the project structure, local setup, and commands.
Contributors [![Contributors][contributors-src]][contributors-href]