Kubb
Define your API once and Kubb generates TypeScript types, clients, hooks, validators, and mocks from an OpenAPI specification.
Highlights
Code generation
// kubb.config.ts plugins: [ pluginTs(), pluginReactQuery(), pluginZod(), ]Define your API once
Kubb turns an OpenAPI or Swagger specification into the code around it.
- TypeScriptAxiosfetchReact QueryVue QuerySWRZodFakerMSWMCP
Plugins you opt into
Compose the ones you need in one config; the core resolves them into one pass.
The spec is the truth
A renamed field becomes a type error, not a runtime surprise.
npx kubb generateOne command
Types, clients, hooks, validators, and mocks.
- MCP
Ready for agents
The MCP plugin exposes the generator over the Model Context Protocol.
A core with plugins on top
The core handles parsing, the plugin graph, and file output, so each generator is a plugin instead of a fixed pipeline.
Documented at kubb.dev
Every plugin and config option has a reference page.
What it is
Kubb is a framework for code generation. Define your API once with an OpenAPI or Swagger specification, and Kubb generates the code around it: TypeScript types, clients, data-fetching hooks, validators, and mock data. The core handles parsing, the plugin graph, and file output, so each generator is a plugin you opt into rather than a fixed pipeline.
Why I built it
Hand-written API layers drift from the specification as soon as the back end changes. Using the specification as the source of truth turns a renamed field or new endpoint into a type error instead of a runtime surprise. The same specification can also drive types, a React Query layer, Zod schemas, and Faker mocks from one config.
Plugins
Kubb ships official plugins for TypeScript types, Axios and fetch clients, TanStack
Query for React and Vue, SWR, Zod validation, Faker mock data, and MSW handlers. An MCP
plugin exposes the generator to AI agents over the Model Context Protocol. You compose the
ones you need in a single kubb.config.ts, and the core resolves them into one generation
pass.
npx kubb generate
See the documentation for the full plugin list and config reference.