Integrations
Run Kubb with Astro
Run Kubb as part of your Astro project with the kubb/astro integration.
kubb/astro runs Kubb as an Astro integration. It hooks into Astro's Vite layer and generates during a build. Pass your Kubb config to the config option.
Install
Install kubb as a dev dependency.
bun add -d kubbpnpm add -D kubbnpm install --save-dev kubbyarn add -D kubbConfigure
Add the integration to your astro.config.mjs:
astro.config.mjs
import { defineConfig } from 'astro/config'import kubb from 'kubb/astro'import { pluginTs } from '@kubb/plugin-ts'const config = { root: '.', input: './petStore.yaml', output: { path: './src/gen', clean: true }, plugins: [pluginTs({ output: { path: 'models' } })],}export default defineConfig({ integrations: [kubb({ config })],})Note
The Astro integration runs through Vite with apply: 'build', so generation runs during astro build only. Run kubb generate before you start the dev server.