DEV Community

Cover image for Which OpenAPI Codegen Should You Choose in 2026? πŸ€” openapi-typescript vs Hey API vs Orval vs Kubb v5 πŸ”₯

Which OpenAPI Codegen Should You Choose in 2026? πŸ€” openapi-typescript vs Hey API vs Orval vs Kubb v5 πŸ”₯

nyaomaru on November 25, 2026

Hoi hoi! I'm @nyaomaru, a frontend engineer who loves TypeScript, OSS, and getting lost in forests of generated code. 🌳 Six months ago, I compare...
Collapse
 
johnnylemonny profile image
𝗝𝗼𝗡𝗻 Necoz •

Great practical comparison! Framing the choice around operational trade-offs like file count, IDE indexing, and error models instead of just feature checklists is what actually matters once an API grows past a few hundred operations.

The distinction between a lightweight type generator like openapi-typescript and fuller platforms like Orval or Kubb is spot on. For larger codebases, having a consistent { path, query, body } signature and a predictable result-style error model like hey-api offers really pays off over shorter per-endpoint call sites.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thanks, John!! πŸ˜ΈπŸ’š

Exactly! Once you have hundreds of endpoints, consistency matters much more than saving a few lines of code.

That's one of the reasons I've been so comfortable with Hey API in production.
But Kubb v5 is making me curious again! 😹

Collapse
 
johnclentoira profile image
john Clent Oira •

Great comparison! I appreciate how you've brought these different OpenAPI code generation tools together.
One thing I'm particularly curious about is long-term maintainability in large projects. When multiple backend teams frequently update their API specifications, generated code changes can become difficult to manage.
Which of these tools would you recommend for a large microservices architecture? And how would you handle breaking API changes automatically within a CI/CD pipeline without disrupting existing frontend applications?
I'd love to hear your perspective on this. Thanks for sharing such a useful comparison! πŸ™Œ

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thanks for the great question! πŸ™Œ

I can only speak confidently about Hey API from production experience, as I haven't used Kubb in a real project yet. 😸

In my current project, I set up an automated workflow like this:

  1. When the backend changes, the OpenAPI YAML is automatically generated.
  2. Hey API generates the clients and types from that specification.
  3. If the generated code contains changes, PRs are automatically created in the relevant frontend repositories.

This works across multiple backend services and frontend repositories, and so far, we haven't encountered any major issues. It's incredibly convenient! πŸ‘

For breaking API changes, I would separate automatic code generation from automatic merging. Type checking, tests, and builds in the frontend CI pipeline can help catch incompatible changes before they reach production.

Of course, breaking changes still require coordination between backend and frontend teams.

So, based on my production experience, I'd confidently recommend Hey API for a microservices architecture. πŸš€

As for Kubb v5, I can't yet make the same claim about its long-term maintainability in production.

However, based on this investigation, I think it's absolutely worth considering, especially if you want to standardize code generation across multiple teams and projects through shared plugins and conventions.

I'm quite excited about its potential! 😸

Collapse
 
johnclentoira profile image
john Clent Oira •

Thanks for sharing your production experience! I really like your approach of separating automated code generation from automatic merging.
That brings up another interesting question. How do you detect breaking API changes that don't necessarily cause TypeScript compilation errors, such as changes in response behavior, validation rules, or business logic? Do you also use contract testing alongside your CI/CD pipeline to catch these issues?
I'd love to hear how your team handles this in practice. Really appreciate the discussion! 😊

Thread Thread
 
nyaomaru profile image
nyaomaru Necoz •

These kinds of behavioral changes are much harder to detect through type checking or code generation alone.

In our current workflow, we run an AI-powered code review on the automatically generated PRs in the frontend repositories. This helps us identify potential compatibility issues that TypeScript might not catch.

Of course, AI review isn't a guarantee, especially when business logic changes aren't reflected in the API specification. Human review and communication between backend and frontend teams are still important.

It's not a perfect solution, but it's a useful additional layer! πŸ™Œ

Thread Thread
 
johnclentoira profile image
john Clent Oira •

That's a really interesting approach! I appreciate your transparency about the limitations of AI-powered code reviews. Combining AI assistance with human expertise seems like a practical balance.
One question that comes to mind: if the AI reviewer only receives the generated frontend code changes, how does it detect behavioral changes in the backend that aren't reflected in the OpenAPI specification? Have you considered providing the AI reviewer with backend implementation changes as additional context?
I think this could be particularly valuable for complex microservices where a seemingly minor backend change can have unexpected downstream effects.
Really enjoying this technical discussion. Thanks for sharing your experience! 😊

Thread Thread
 
nyaomaru profile image
nyaomaru Necoz •

Exactly! 😸

That's actually what we're doing. Our AI reviewer checks the backend implementation as well, rather than relying solely on the generated frontend code or OpenAPI specification.

This gives it more context to identify potential downstream impacts that aren't visible in the schema alone. πŸ™Œ

Collapse
 
emilywoodsnyc profile image
Emily Woods •

The network-failure row is the comparison I would keep next to the generated client. It is easy to read nonthrowing mode as a promise about the whole call. A tiny shared fixture with an HTTP error, an empty error body and a broken connection would be a useful regression check whenever the generator gets upgraded.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Good point, Emily! πŸ˜ΈπŸ’š

Nonthrowing mode doesn't necessarily mean the entire call is safe from exceptions.

Personally, I think a well-designed type system can prevent many of these issues by making callers handle the possible outcomes explicitly, although network failures still need careful runtime handling. 😺

Collapse
 
arslan_ah profile image
Arslan Ahmad •

Love that you came back six months later. These tools move so fast that most comparison posts are stale by the time anyone finds them.

Biggest lesson for me: the generator matters less than the spec. Inconsistent operationIds and inline schemas everywhere make every generator look bad. Clean, spec-first contracts make even the simple ones shine. That spec-first mindset is a big part of what we teach in Grokking the API Design Interview at DesignGurus.

Kubb v5's plugin setup does look tempting though...

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thanks, Arslan! πŸ˜ΈπŸ’š

Technology moves incredibly fast, especially in the AI era. It's really interesting to revisit these tools every few months and see how much has changed!

And I totally agree that a well-designed API specification is the foundation of good code generation. πŸ™Œ

Collapse
 
paullovelace profile image
Paul Lovelace •

The rename test is the table I'd actually decide on β€” one operationId renamed and Kubb touches 6 files and 118 changed lines, Hey API touches 3 files and 18. The 2,897-file forest looks fine until a rename lands in a real PR. Do reviewers just start rubber-stamping generated diffs at that size, or does the per-file smallness actually make review easier?

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Great question, Paul! 😸

I don't think every generated diff needs to be reviewed manually. Ideally, CI catches most breaking changes in types and data shapes, and we focus human review on the changes that need attention.

Personally, I find files separated by responsibility easier to review, but too much fragmentation can make navigation harder too.

It's all about finding the right balance rather than simply minimizing the file count! πŸ™Œ

Collapse
 
sigasystems profile image
SiGa Systems •

Really useful comparison, especially the focus on maintainability as APIs grow. One important consideration in larger applications is keeping frontend and backend contracts consistent as endpoints and schemas evolve.

I also like the point about using shared code generation rules instead of letting every project or developer create different API patterns. That can make a real difference in reducing inconsistencies and keeping development workflows manageable.

Great breakdown of the practical trade-offs between these tools

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thank you! πŸ˜ΈπŸ’š

Exactly! Especially now that AI can generate code so quickly, I think having shared conventions and a consistent foundation across projects is more valuable than ever.

I'd rather automate consistency than repeatedly fix inconsistencies! 😹

Collapse
 
the_daily_flare profile image
The daily flare •

I found the rename test especially useful because it showed me the real cost of a small change.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thank you! πŸ˜ΈπŸ’š
I'm glad to hear that! πŸ‘

Collapse
 
linkbruno profile image
linkbruno.com •

type NullEnum = never is scarier than it looks, because a never inside a union just disappears. A field generated as string | NullEnum becomes plain string, the nullable case is gone, and the compiler is perfectly happy about it. That's the kind of regression you only catch by reading generated output, so a handful of type-level assertions on known tricky schemas (expectTypeOf or a tsd file) seem worth running after every generator upgrade. Have you thought about publishing the fixtures from this comparison as a small suite people could point their own setup at?

Collapse
 
elsie-rainee profile image
Elsie Rainee •

Most comparisons stop at generation speed, so I appreciated that you also measured TypeScript compile time (about 2.44s for Hey API vs 3.80s for Kubb). That's the cost developers feel every day in the IDE and in CI, and the generation numbers hide it.

The TanStack Query finding was the most useful part for me. Orval resolving on an HTTP 400 by default is the kind of silent failure that only shows up in production, so it's worth a line in everyone's setup checklist (forceSuccessResponse: true).

The operationId rename test (+2/βˆ’2 for openapi-typescript vs +59/βˆ’59 across 6 files for Kubb) also made me think about review overhead. Do you have a sense of whether Kubb's distributed output makes PR diffs on regenerated code noisier in practice, or does the per-file split make them easier to skim?

Thanks for testing the edge cases like the null-only enum instead of trusting the happy path.