Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content

Introduction

Kubb is a meta framework for code generation. It runs a plugin-based pipeline on top of any API specification. An adapter reads your spec. Parsers turn the AST into source files. Plugins generate the output. The pipeline writes, formats, and lints the result, all from a single config file.

The default adapter reads OpenAPI 2.0, 3.0, and 3.1. For GraphQL, JSON Schema, gRPC, or any other format, you write your own adapter. From there Kubb generates TypeScript types, React Query hooks, Zod validators, MSW mocks, or a custom output. You stop hand-maintaining generated code. The output is deterministic. The same spec always produces the same result.

Features

Feature Description
TypeScript types Type-safe interfaces and types from your schemas
API clients Type-safe HTTP clients for Axios or Fetch
React Query hooks useQuery and useMutation hooks for React Query
Vue Query composables The same hooks, for Vue Query
Zod schemas Runtime validation schemas via Zod
MSW handlers Mock Service Worker handlers for frontend development and testing
Faker mocks Realistic mock data using Faker.js
Cypress tests End-to-end API tests with Cypress
MCP servers Model Context Protocol servers so AI assistants can interact with your API
Custom plugins Write your own using the same APIs the official plugins use

Start with Installation or Basic Usage. For deeper reference, see Configuration, Recipes, and Integrations.

Community

Join the Discord server, file an issue on GitHub, or sponsor the project.