Quick start
npm i -D @mrzr/openapi-forgenpx @mrzr/openapi-forge init # writes openapi-forge.config.yamlnpx @mrzr/openapi-forge --input swagger.json --out src/api/generated --api-prefix /api/v1With the default client: "builtin" small files are written once next to the layer
(client.ts, hooks.ts and types.ts). They are yours to edit and are never overwritten
(--force-runtime resets them). The hooks need the package of the library they wrap —
@tanstack/react-query v5 by default, see Hook libraries.
// src/api/generated/client.ts — written once, yours to edit. The default client is @mrzr/api-client:// it finds its base URL in the environment (VITE_API_URL, …); give it the tokens and plugins it needs.export const apiClient = createClient();import { useListPetsQuery, useCreatePetMutation } from "./api/generated";
const pets = useListPetsQuery({ kind: "cat" }); // pets.data is api-client's own answer: pets.data?.data is the listconst create = useCreatePetMutation();create.mutate({ body: { name: "Tom" } });Without @mrzr/api-client, pick another client with http: "axios", "fetch" (nothing to install; functions only, --target requests) or "angular" (an injectable service over HttpClient). Each is called as itself — see HTTP clients.