npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@7nohe/openapi-react-query-codegen

v3.0.2

Published

OpenAPI React Query Codegen

Readme

OpenAPI React Query Codegen

Code generator for TanStack Query (React Query) based on your OpenAPI schema — queryOptions factories following the official TanStack Query v5 pattern, plus ready-to-use hooks, prefetch, ensure, suspense, and infinite query helpers.

npm version

📖 Documentation · Migrating to v3

Features

  • queryOptions / infiniteQueryOptions factories for every GET operation — the TanStack Query v5 recommended pattern, composable with useQuery, useQueries, useSuspenseQuery, prefetchQuery, ensureQueryData, and setQueryData with full type safety
  • Custom hooks: useQuery, useSuspenseQuery, useMutation, useInfiniteQuery, and useSuspenseInfiniteQuery variants per operation
  • SSR helpers: prefetchQuery, prefetchInfiniteQuery, and ensureQueryData functions per operation — ready for Next.js App Router hydration
  • Hierarchical query keys with exported key constants and functions: invalidate one exact query, all infinite pages of an operation, or every cache entry of an operation with a single prefix
  • Pure TypeScript clients generated by @hey-api/openapi-ts (fetch and axios)

Quick start

npm install -D @7nohe/openapi-react-query-codegen
npx openapi-rq -i ./petstore.yaml
import { useQuery } from "@tanstack/react-query";
import { findPetsOptions } from "./openapi/queries";

function Pets() {
  const { data } = useQuery(findPetsOptions({ query: { limit: 10 } }));
  // ...or use the generated hook directly: useFindPets({ query: { limit: 10 } })
}

See the documentation for CLI options, SSR recipes, and infinite query usage.

How it compares

| | This library | @hey-api tanstack-query plugin | Orval | |---|---|---|---| | queryOptions / infiniteQueryOptions factories (TanStack v5 pattern) | ✅ | ✅ | ❌ | | Ready-to-use hooks (useQuery / suspense / infinite variants) | ✅ | ❌ (options only) | ✅ | | SSR helpers (prefetchQuery / prefetchInfiniteQuery / ensureQueryData) | ✅ | ❌ | Partial (usePrefetch) | | Hierarchical query keys for granular invalidation | ✅ | ✅ (tags) | Partial | | Stable release line | ✅ SemVer | pre-1.0, frequent breaking changes | ✅ | | MSW mock generation | ❌ (out of scope) | ❌ | ✅ | | Vue / Solid / Svelte / Angular | ❌ React-focused | ✅ | ✅ |

Scope: this library is deliberately React-focused and does not generate API mocks — use Orval if MSW mocks are your priority, or hey-api's own plugin if you need non-React frameworks.

Stability policy

This library builds on @hey-api/openapi-ts, which is pre-1.0 and moves fast. We pin the exact hey-api version and absorb its breaking changes for you: hey-api upgrades land here only after our full snapshot-test suite passes, and are released as minor versions. Your generated API surface follows SemVer — breaking output changes only happen in major versions, with a migration guide.

Requirements

  • Node.js 22.18+
  • @tanstack/react-query 5.x (peer dependency)
  • typescript 5.x or 6.x, ts-morph 28.x, commander 12–15 (peer dependencies)

License

MIT