
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
apigen-tanstack
Advanced tools
Generate TanStack Query v5 React hooks from OpenAPI/Swagger specs with built-in test mode
Generate TanStack Query v5 React hooks from OpenAPI/Swagger specs with built-in test mode.
import { useListPets, useCreatePet } from './api/generated'
function PetList() {
const { data: pets, isLoading } = useListPets()
const createPet = useCreatePet()
if (isLoading) return <div>Loading...</div>
return (
<div>
<ul>
{pets?.map(pet => (
<li key={pet.id}>{pet.name}</li>
))}
</ul>
<button onClick={() => createPet.mutate({ name: 'Buddy' })}>
Add Pet
</button>
</div>
)
}
useQuery for GET, useMutation for POST/PUT/PATCH/DELETE--splitapigen.config.ts with auto-discovery or --config flagallOf--dry-run before writingnpm install -D apigen-tanstack
# From a local file
npx apigen-tanstack generate --input ./openapi.yaml --output ./src/api/generated
# From a config file
npx apigen-tanstack generate --config apigen.config.ts
# Interactive mode (omit flags to be guided through setup)
npx apigen-tanstack generate
# Preview without writing
npx apigen-tanstack generate -i ./openapi.yaml --dry-run
| File | Description |
|---|---|
types.ts | TypeScript interfaces from schemas |
hooks.ts | useQuery / useMutation hooks per endpoint |
mocks.ts | Static mock data from schemas |
test-mode-provider.tsx | React context for toggling mock mode |
index.ts | Barrel re-exports |
Wrap your app with the provider to return mock data instead of real API calls:
import { ApiTestModeProvider } from './api/generated'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const queryClient = new QueryClient()
<QueryClientProvider client={queryClient}>
<ApiTestModeProvider enabled={true}>
<App />
</ApiTestModeProvider>
</QueryClientProvider>
MIT
FAQs
Generate TanStack Query v5 React hooks from OpenAPI/Swagger specs with built-in test mode
We found that apigen-tanstack demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.