More Premium Hugo Themes Premium Nextjs Themes

Rapini

:leafy_green: OpenAPI to React Query (or SWR) & Axios

Rapini

:leafy_green: OpenAPI to React Query (or SWR) & Axios

Author Avatar Theme by rametta
Github Stars Github Stars: 179
Last Commit Last Commit: Oct 14, 2025 -
First Commit Created: Jan 15, 2024 -
Rapini screenshot

Overview

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.

Features

  • Generates Axios calls for every endpoint: Generates typed payload for each endpoint in the OpenAPI spec file.
  • Generates custom react hooks using React Query: Generates custom hooks that use React Query’s useQuery and useMutation hooks for each axios call. Optional to generate custom hooks that use SWR’s useSWR hook.
  • Generates query keys for every hook: Generates query keys for every hook to identify and track the requests.
  • Generates strong Typescript types: Generates strong Typescript types for all inputs, outputs, and options.

Installation

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.

Summary

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.