Kubb 5.x · API spec to code 8.3M yearly downloads
Turn your API spec into type-safe code.
Kubb is an open source code generator. Point it at your API spec, such as OpenAPI, and get TypeScript types, API clients, TanStack Query hooks, Zod schemas and MSW mocks, always in sync with your API.
- Open source, MIT licensed
- OpenAPI 2.0, 3.0 and 3.1
- Runs anywhere Node runs
Generates code for
See it in action
From spec to code
Watch how Kubb turns one OpenAPI spec into types, hooks and validators.
openapi: 3.0.0
info:
title: Pet Store API
version: 1.0.0
paths:
/pets:
get:
operationId: getPets
summary: List all pets
parameters:
- name: limit
in: query
schema:
type: integer
responses:
'200':
description: A list of pets
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
components:
schemas:
Pet:
type: object
required:
- id
- name
properties:
id:
type: integer
name:
type: string
status:
type: string
enum: [available, pending, sold]Ecosystem
Adapters, plugins and parsers
Mix and match what your stack needs: types, clients, hooks, validators and mocks.
Review every generated change in Kubb Studio.
Connect the Kubb CLI or a Docker agent, generate from the browser and diff the output before it reaches your repository. Code stays on machines you control.
Sponsors
Keep Kubb free and independent
Kubb is MIT licensed and maintained in the open. Sponsorships pay for maintenance, releases and new plugins, and your logo reaches every developer who reads these docs.
Gold Sponsor
Bug and feature prioritization for Kubb.
$500
/month
- Bug prioritization for Kubb.
- Feature prioritization for Kubb.
- Your avatar will be visible as Gold on all major projects.
- Your avatar will be visible as Gold on the home page of kubb.
Silver Sponsor
Visibility on all major Kubb projects.
$250
/month
- Your avatar will be visible as Silver on all major projects.
- Your avatar will be visible as Silver on the home page of kubb.
Bronze Sponsor
You are serious about supporting Kubb!
$100
/month
- Your avatar will be visible as Bronze on my major projects.
- Your avatar will be visible as Bronze on the home page of kubb.
Generate your first client in minutes.
Run npx kubb init, point it at your spec and get type-safe code.