Installation
Every setup starts with @hyper-fetch/core. Add the packages for your framework, transport and tooling on top
of it.
- npm
- yarn
- pnpm
npm install @hyper-fetch/core
yarn add @hyper-fetch/core
pnpm add @hyper-fetch/core
Add the lint plugin
The request generics are objects (createRequest<{ response: User }>()), and TypeScript accepts unknown keys in them
without an error. The lint plugin reports misspelled or unknown generic keys, so install it next to core.
- npm
- yarn
- pnpm
npm install --save-dev eslint-plugin-hyper-fetch
yarn add --dev eslint-plugin-hyper-fetch
pnpm add --save-dev eslint-plugin-hyper-fetch
Using Oxlint? Install oxlint-plugin-hyper-fetch instead. It has the same rules.
Setup for both is on the ESLint plugin page.
Add your framework
React hooks (useFetch, useSubmit and the others) need React 18 or newer.
- npm
- yarn
- pnpm
npm install @hyper-fetch/core @hyper-fetch/react
yarn add @hyper-fetch/core @hyper-fetch/react
pnpm add @hyper-fetch/core @hyper-fetch/react
For WebSocket and server-sent events, add sockets. It works with or without React.
- npm
- yarn
- pnpm
npm install @hyper-fetch/sockets
yarn add @hyper-fetch/sockets
pnpm add @hyper-fetch/sockets
All packages
| Package | What it adds |
|---|---|
@hyper-fetch/core | Client, requests, cache, dispatchers and the fetch adapter |
@hyper-fetch/react | React hooks and the Hydrate component |
@hyper-fetch/sockets | Realtime listeners and emitters over WebSocket and SSE |
@hyper-fetch/db | Collections of typed rows with live queries and optimistic writes |
@hyper-fetch/axios | Axios adapter, with upload progress in the browser |
@hyper-fetch/graphql | GraphQL adapter for queries, mutations and subscriptions |
@hyper-fetch/firebase | Firestore and Realtime Database adapter for the client SDK |
@hyper-fetch/firebase-admin | The same adapter for the Firebase Admin SDK on the server |
@hyper-fetch/trpc | Typed requests from a tRPC router |
@hyper-fetch/orpc | Typed requests from an oRPC router |
@hyper-fetch/hono | A typed SDK from a Hono app type |
@hyper-fetch/elysia | A typed SDK from an Elysia app type |
@hyper-fetch/plugin-devtools | Connects a client to the HyperFlow devtools app |
@hyper-fetch/cli | Generates a typed SDK from an OpenAPI or Swagger schema |
eslint-plugin-hyper-fetch | Lint rules for request and client generics |
oxlint-plugin-hyper-fetch | The same lint rules for Oxlint |