Build tools
Generate code from your API spec with Astro
Add the kubb/astro integration to astro.config.mjs so every Astro build generates code from your API spec with the plugins in your kubb.config.ts.
kubb/astro generates code from your kubb.config.ts once, before astro build continues. It ships with kubb.
The integration adds the Vite plugin to Astro, so Kubb runs on
astro build only. Run kubb generate before astro dev.Install Kubb and your plugins
Follow Installation.
Add Kubb to astro.config.mjs
Pass one config object from your kubb.config.ts as config, not an array or a function.
astro.config.mjs
import { defineConfig } from 'astro/config'
import kubb from 'kubb/astro'
import config from './kubb.config'
export default defineConfig({
integrations: [kubb({ config })],
})Run the build
Run astro build. If Kubb fails, the build fails.
How the build runs Kubb covers defaults, reports, and watch rebuilds.
