Plugin
plugins: [pluginVueQuery()]Officialv5.11.0kubb >=5.19.0node >=22.22
OpenAPI to Vue Query generator
@kubb/plugin-vue-query
Generates typed TanStack Query helpers for Vue from your OpenAPI spec: queryOptions factories with query and mutation keys, plus optional composables.
kubb add plugin-vue-query
vue-querytanstack-queryvuecomposablesdata-fetchingcodegenopenapi
- Downloads66.1K/ monthnpm, last 30 days
- GitHub stars13kubb-labs/plugins
- Unpacked size595.7kBv5.11.0 on npm
- Latest release3d agov5.11.0 · Nov 19, 2026
The Vue Query plugin generates TanStack Query queryOptions factories, query and mutation keys, and optional composables from your OpenAPI spec.
hooks: trueaddsuseQueryanduseMutationcomposables that take reactive parameters, with infinite variants on request.- The plugin ships no HTTP client. Each helper calls a function from your client plugin.
Installation
kubb add plugin-vue-querybun add -d @kubb/plugin-vue-querypnpm add -D @kubb/plugin-vue-querynpm install --save-dev @kubb/plugin-vue-queryyarn add -D @kubb/plugin-vue-querykubb add installs the version the Kubb registry pins and adds pluginVueQuery() to kubb.config.ts. It needs a kubb.config.ts, so run kubb init first in a new project.
Setup
- Add
@kubb/plugin-ts, orpluginZod({ inferred: 'codec' })withzodv4 in the app. - Add one client plugin:
@kubb/plugin-fetch,@kubb/plugin-axios,@kubb/plugin-ky, or@kubb/plugin-client. Leavesdkunset on it. - Install
@tanstack/vue-query5.41 or a later v5 release andvue3.3 or later in the app. - Set the base URL, auth, and validation on the client plugin. With
@kubb/plugin-client, your client module owns them.
Options worth knowing
| Option | What it does |
|---|---|
client | Picks 'fetch', 'axios', 'ky', or 'client' when several client plugins are registered. |
hooks | Adds the use* composables. infinite needs it. |
query, mutation | Which HTTP methods become queries and mutations. false skips them. |
infinite | Adds infinite queries to operations with the infinite.queryParam parameter, 'id' by default. |
Example
This config generates composables that call the Fetch client.
kubb.config.ts
import { defineConfig } from 'kubb/config'
import { adapterOas } from '@kubb/adapter-oas'
import { pluginTs } from '@kubb/plugin-ts'
import { pluginFetch } from '@kubb/plugin-fetch'
import { pluginVueQuery } from '@kubb/plugin-vue-query'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen' },
adapter: adapterOas({ integerType: 'number' }),
plugins: [
pluginTs(),
pluginFetch(),
pluginVueQuery({ hooks: true }),
],
})See Options for every option. Next, call operations.
Dependencies
No extension dependencies.
Optional dependencies
Extensions Vue Query works with when they are in the config.
