Skip to content

What is tanstack-fetch?

tanstack-fetch (by Mohammad Garmabi) is a tiny, typed Fetch client shaped for @tanstack/react-query.

It is not an official TanStack package — it matches the same mental model Query expects from a queryFn:

  1. Return data on success
  2. Throw on HTTP failure (FetchError)
  3. Honor AbortSignal so cancel / unmount is clean

Mental model

Who it’s for

  • Apps already on TanStack Query that want a smaller alternative to axios / ky
  • Next.js / TanStack Start apps that need SSR cookie forwarding
  • Teams that want SSE with Authorization (not EventSource)
  • tRPC users who want one shared auth/plugin client

Entry points

Entry points

ImportWhat you getTypical gzip
tanstack-fetchHTTP (get / post / upload / …)~3.5KB
tanstack-fetch/sse+ api.sse()~4.7KB
tanstack-fetch/pluginsplugin factories~0.9KB
tanstack-fetch/reactFetchProvider / hooks~1KB
tanstack-fetch/trpctRPC link via createFetch~3.1KB
ts
import { createFetch } from 'tanstack-fetch' // HTTP only
import { createFetch } from 'tanstack-fetch/sse' // + streams

Next

MIT Licensed · Created by Mohammad Garmabi · Not an official TanStack package