Three generators, one CLI
Choose useFetch, useAsyncData, or Nuxt server routes (BFF mode). Mix and match per project.
Point it at your OpenAPI spec and get fully typed useFetch composables, useAsyncData composables, or Nuxt server routes — ready to use, nothing to write by hand.

Run the CLI and pick your generators:
npx nxh generateComposables (useFetch or useAsyncData):
<script setup lang="ts">
// Fully typed — petId: number, data: Pet | null, error typed
const { data: pet, pending, error } = useFetchGetPetById(
{ petId: 123 },
{
onSuccess: (pet) => console.log('Loaded:', pet.name),
onError: (err) => showToast(err.message, 'error'),
}
)
</script>Server routes (BFF mode):
// Generated: server/api/pet.post.ts
export default defineEventHandler(async (event): Promise<Pet> => {
const auth = await getAuthContext(event) // your auth logic
const data = await $fetch(`${config.apiBaseUrl}/pet`, {
headers: { Authorization: `Bearer ${config.apiSecret}` }, // key never exposed
})
return transformPet(data, event, auth) // your transform logic
})Your transformer stub (server/bff/transformers/pet.ts) is generated once and never overwritten — add your business logic there:
export async function transformPet<T = any>(
data: T,
event: H3Event,
auth: AuthContext | null
): Promise<T> {
return {
...(data as any),
canEdit: auth?.permissions.includes('pet:write') ?? false,
} as T
}Every endpoint in your OpenAPI spec becomes a ready-to-use composable or server route. If your spec has 40 endpoints, you get 40 typed composables with one command.
Generated composables use Nuxt's own useFetch and useAsyncData under the hood — fully SSR-compatible, works in components and pages without any setup. On top of that, you get lifecycle callbacks (onRequest, onSuccess, onError, onFinish), pick to trim the response, global callback plugins, and request interception. All the SSR guarantees of Nuxt, with more control where you need it.
The useAsyncData generator exposes raw response access — read status codes, response headers, and the full HTTP response before it hits your component. Useful for pagination headers, ETag caching, or any API that communicates via headers.
In BFF mode, credentials live in Nuxt runtimeConfig and are only used in server routes. The client calls /api/pet, not your backend directly.
Transformers and auth context are generated once. When you regenerate after a spec update, only the route files change — your business logic is untouched.