Generate TypeScript fetch functions and type definitions from your backend's OpenAPI spec automatically.
Create React Query hooks for every API endpoint from an OpenAPI file in a single command.
Generate MSW mock handlers from your OpenAPI spec to test your frontend UI without a real backend running.
Keep your frontend API client in sync with backend API changes by re-running Orval after spec updates.
Requires an existing OpenAPI or Swagger spec file, generated code depends on whichever client library you configure (e.g. React Query must be installed separately).
Orval is a code generation tool for TypeScript developers. It reads an API specification file (in OpenAPI v3 or Swagger v2 format, either YAML or JSON) and automatically generates all the TypeScript code you need to call that API from your frontend application. Instead of writing HTTP request functions and type definitions by hand, you run Orval and it produces them for you. The generated code can target several different client libraries and frameworks. Orval supports plain fetch calls, React Query, Vue Query, Svelte Query, Solid Query, Angular, Angular Query, SolidStart, Hono, and Zod schema validation. It also generates mock handlers for testing with Mock Service Worker (MSW), so you can test your UI against a fake API without a real server running. You configure Orval through a config file where you point it at your OpenAPI spec (which can be a local file or a remote URL) and tell it where to write the output and which client type to generate. Running the orval command then produces the files. When your API changes, you re-run Orval to update the generated code. The project is written in TypeScript and uses Bun for its own build and test process. The repository includes sample projects for each supported framework so you can see what the generated output looks like before setting it up in your own project. There is also a playground on the project website where you can try it without installing anything. Orval is MIT licensed and maintained through open-source contributions. The project is funded through Open Collective, and financial supporters have their logos listed in the README.
← orval-labs on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.