Skip to content

← Blog

Published: 2024-09-01

Kubb v3

Kubb v3 is a major release. Here's what changed.

What is Kubb?

Kubb automates code generation from OpenAPI specs: API clients, TypeScript types, Zod schemas, React Query hooks, and more. If you're new to Kubb, check the docs.

What's new in Kubb v3?

  1. Updated plugin architecture

The plugin architecture was overhauled. Generation is faster and the CLI now shows a progress bar so you can see what's running.

Left: v3 Right: v2

React-DevTools Tanstack Query integration also changed: each framework (React, Vue, Solid, Svelte) is now its own package, so you only install what you need.

  1. Dropping support for Tanstack Query v4

Kubb v3 targets Tanstack Query v5 only. If your project still depends on v4, stay on Kubb v2.

  1. Generators: the core of Kubb v3

TIP

In v2 of Kubb we used the name templates.

Generators let you hook into the file generation process and customize or add code dynamically. Each plugin uses generators for file creation. In v3 you can also reuse existing generators from other plugins.

For example, if you're using @kubb/plugin-client to generate an API client but want to append additional functionality to the generated files, you can either:

  • Use the footer option to add code.
  • Override the default generator and add your own logic.
  1. Improved performance

The core engine has been rewritten for speed. The CLI gives faster feedback and more relevant output during builds.

  1. File extensions and compatibility

Recent Node.js versions require explicit file extensions on imports. Kubb v3 appends .ts to generated files by default. If your project doesn't use this Node.js configuration yet, switch to .js or remove the extension.

  1. Expanded OpenAPI support

Previously Kubb was closely tied to Swagger. v3 adds full support for OpenAPI v3 and v3.1. The internal architecture is now also easier to extend with support for other spec formats.

Migrating to Kubb v3

See the migration guide for the full upgrade steps.

Star History Chart

👋🏽 Stijn Van Hulle