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

Run Kubb with Farm

kubb/farm runs Kubb as a Farm plugin. Farm is a Rust-based web build tool with a Vite-compatible plugin API. Pass your Kubb config to the config option.

Install

Install kubb as a dev dependency.

shell
bun add -d kubb@beta
shell
pnpm add -D kubb@beta
shell
npm install --save-dev kubb@beta
shell
yarn add -D kubb@beta

Configure

Add the plugin to your farm.config.ts and pass it your Kubb config.

farm.config.ts
typescript
import { defineConfig } from '@farmfe/core'
import kubb from 'kubb/farm'
import { pluginTs } from '@kubb/plugin-ts'

const config = {
  root: '.',
  input: { path: './petStore.yaml' },
  output: { path: './src/gen', clean: true },
  plugins: [pluginTs({ output: { path: 'models' } })],
}

export default defineConfig({
  plugins: [kubb({ config })],
})