Nuxt Open Fetch is a Nuxt module that generates zero-overhead, fully typed OpenAPI clients, turning $fetch and useFetch into type-safe composables for Nuxt applications.
What is Nuxt Open Fetch?
Nuxt Open Fetch is an open-source Nuxt module that consumes an OpenAPI specification (OpenAPI 3.0 or 3.1) in JSON or YAML format, loaded either from a local file or a remote URL, and generates TypeScript types and typed fetch composables for your Nuxt app. It builds on the openapi-typescript generator to produce runtime-free types that give full IDE autocompletion and end-to-end type safety without a code generation step at runtime. The module is published under the MIT License and maintained by Norbiros, with development led on GitHub.
Key Features
- Zero-overhead typed client: Generates types that are erased at runtime, so there is no runtime performance cost.
- Supports OpenAPI 3.0 and 3.1: Handles advanced OpenAPI features such as discriminators.
- YAML or JSON schemas: Load your API schema from local files or remote endpoints.
- Nuxt Layers support: Works with multi-layer Nuxt projects, allowing shared API definitions across layers.
$fetchanduseFetchon steroids: Provides typed wrappers around Nuxt's built-in fetch functions.- No manual typing: You never hand-write API request or response types; they come directly from the schema.
Who is it for?
- Nuxt developers building apps against a REST API with an OpenAPI schema: they get end-to-end type safety for all API calls.
- API consumers in monorepos or multi-layer projects: they can centralize API types in a Nuxt layer and share them across apps.
- Teams that rely on code review and IDE assistance: generated types make refactors and API changes easier to catch at compile time.
What can you do with Nuxt Open Fetch?
- Fetch typed data: Use
useFetchor$fetchwith automatic typing of response bodies, query parameters, and request bodies based on your OpenAPI spec. - Share API contracts: Put your OpenAPI schema in a Nuxt layer so multiple applications or services consume the same typed endpoints.
- Keep schemas current: Since types are generated from the spec, updating the spec and regenerating updates all typed calls, reducing drift.
How does Nuxt Open Fetch work?
After installing the module with your package manager and adding it to the modules section of nuxt.config.ts, the module reads your OpenAPI schema and generates TypeScript definitions that Nuxt's fetch composables use. You do not run a separate generation command; the module wires it into your build pipeline.
Pricing
Nuxt Open Fetch is free and open source under the MIT License. There are no paid tiers or subscription plans.
FAQ
Is Nuxt Open Fetch free?
Yes, the module is published under the MIT License, so you can use, modify, and embed it in commercial projects without fees.
What OpenAPI versions are supported?
Nuxt Open Fetch supports OpenAPI 3.0 and 3.1, including features like discriminators, and loads schemas from YAML or JSON, locally or remotely.
Do I have to write TypeScript types manually?
No. The module generates types directly from your OpenAPI schema, so there is no manual typing of API requests or responses.
Is Nuxt Open Fetch stable?
The module is still pre-1.0, and the API is subject to change before v1.0.0. The project maintains a changelog and welcomes suggestions.








