{"id":49046,"library":"rapini","title":"Rapini","description":"Rapini is a CLI code generator that produces React Query (v3/v4/v5), SWR hooks, Axios requests, and TypeScript types from OpenAPI specifications. Current stable version is 3.5.4 with monthly releases. It differentiates itself by packaging the generated code as a publishable npm package, supporting multiple React data-fetching libraries, and offering query key generation. Compatible with OpenAPI 3.0 and Swagger 2.0.","status":"active","version":"3.5.4","language":"javascript","source_language":"en","source_url":"https://github.com/rametta/rapini","tags":["javascript","codegen","react-query","tanstack","swr","stale-while-revalidate","react","query","axios"],"install":[{"cmd":"npm install rapini","lang":"bash","label":"npm"},{"cmd":"yarn add rapini","lang":"bash","label":"yarn"},{"cmd":"pnpm add rapini","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Generated HTTP client requests","package":"axios","optional":false},{"reason":"Required when generating react-query v4/v5 output","package":"@tanstack/react-query","optional":true},{"reason":"Required when generating react-query v3 output","package":"react-query","optional":true},{"reason":"Required when generating swr output","package":"swr","optional":true}],"imports":[{"note":"Use npx for latest; CLI tool, not a library import.","wrong":"npm install -g rapini && rapini","symbol":"default","correct":"npx rapini react-query v5 -p openapi.yaml"},{"note":"Generated hooks are named exports; no default export in generated package.","wrong":"import useGeneratedQuery from 'my-api-package'","symbol":"useGeneratedQuery","correct":"import { useGeneratedQuery } from 'my-api-package'"},{"note":"Generated package is ESM; use named import.","wrong":"const generatedQueryKey = require('my-api-package').generatedQueryKey","symbol":"generatedQueryKey","correct":"import { generatedQueryKey } from 'my-api-package'"}],"quickstart":{"code":"// 1. Generate an API package from an OpenAPI file\nnpx rapini react-query v5 -p ./openapi.yaml -o ./my-api -n my-api\n// 2. In your React app, install the generated package and dependencies\nnpm install ./my-api @tanstack/react-query axios\n// 3. Use the generated hooks\nimport { useGetUsers } from 'my-api';\nfunction Users() {\n  const { data, isLoading } = useGetUsers();\n  if (isLoading) return <div>Loading...</div>;\n  return <ul>{data?.map(u => <li key={u.id}>{u.name}</li>)}</ul>;\n}","lang":"typescript","description":"Generates a React Query v5 package from OpenAPI spec, then uses a typed hook in a React component to fetch data."},"warnings":[{"fix":"Ensure the matching version of React Query is installed (v3, v4, or v5).","message":"Generated package requires specific version of @tanstack/react-query or react-query.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use `npx rapini react-query v5` instead of `npx rapini react-query` (which defaults to v3).","message":"React Query V3 generation is deprecated in favor of TanStack Query v4/v5.","severity":"deprecated","affected_versions":"<4.0.0"},{"fix":"Validate your OpenAPI spec with tools like swagger-cli before generation.","message":"OpenAPI file must be valid; errors produce incomplete or broken generated code.","severity":"gotcha","affected_versions":"all"},{"fix":"Import using ES module syntax in your project.","message":"Generated package uses ESM only; CommonJS require() will fail.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'2.0':62 '3.0':59 '3.5.4':27 'axio':15,76 'cli':5 'code':6,38 'codegen':64 'compat':56 'current':23 'data':48 'data-fetch':47 'differenti':32 'fetch':49 'generat':7,37,55 'hook':14 'javascript':63 'key':54 'librari':50 'month':29 'multipl':45 'npm':42 'offer':52 'openapi':21,58 'packag':35,43 'produc':9 'publish':41 'queri':11,53,67,75 'rapini':1,2 'react':10,46,66,74 'react-queri':65 'releas':30 'request':16 'revalid':73 'specif':22 'stabl':24 'stale':71 'stale-while-revalid':70 'support':44 'swagger':61 'swr':13,69 'tanstack':68 'type':19 'typescript':18 'v3/v4/v5':12 'version':25","created_at":"2026-06-07T16:59:46.598890+00:00","updated_at":"2026-06-07T16:59:46.598890+00:00","problems":[{"fix":"npm install @tanstack/react-query","cause":"Missing peer dependency","error":"Cannot find module '@tanstack/react-query'"},{"fix":"Fix the syntax of your openapi.yaml or openapi.json file","cause":"Invalid YAML or JSON","error":"Error: Could not parse OpenAPI file"},{"fix":"Ensure you are using `npx rapini` (lowercase) and clear npx cache: `npx clear-npx-cache`","cause":"Using old npx cache or wrong command","error":"TypeError: rapini is not a recognized command"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rametta/rapini","github":"https://github.com/rametta/rapini","docs":null,"changelog":null,"pypi":null,"npm":"rapini","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}