Kubb
The meta framework for code generation. Define your API once and Kubb generates types, clients, hooks, validators, and mocks from an OpenAPI spec.
What it is
Kubb is a meta framework for code generation. You define your API once as an OpenAPI or Swagger spec, and Kubb generates the glue code around it: TypeScript types, type-safe 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 spec the moment the back-end changes. Treating the spec as the source of truth means a renamed field or a new endpoint shows up as a type error instead of a runtime surprise. The meta-framework approach pushes that idea further: the same spec can drive types, a React Query layer, Zod schemas, and Faker mocks at once, all kept in sync 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.