:leafy_green: OpenAPI to React Query (or SWR) & Axios
Rapini is a CLI tool that generates React Query (or SWR) hooks, Axios requests, and Typescript types based on an OpenAPI spec file. The generated code is conveniently packaged so that it can be published as an NPM package.
useQuery and useMutation hooks for each axios call. Optional to generate custom hooks that use SWR’s useSWR hook.To install Rapini, you can execute the following command in your terminal:
npm install -g rapini
Once installed, you can use the CLI tool to generate the package code based on an OpenAPI file. For example:
rapini generate path/to/openapi.yaml
The outputted code will be packaged in a way that allows you to publish it as your own NPM package. You can import it into your React project by installing the package in your project and importing the generated code.
Rapini is a CLI tool that simplifies the process of generating React Query (or SWR) hooks, Axios requests, and Typescript types based on an OpenAPI spec file. It automates the generation of code and package configuration, making it easier to integrate API functionalities into React projects. With its features like generating query keys and strong Typescript types, Rapini streamlines the development process and improves code quality.