Skip to content
rhttp.io

Welcome

rhttp.io The isomorphic HTTP client for TypeScript that gets out of your way.

Zero-boilerplate config, automatic cookie forwarding, caching, retries, circuit breaker, JWT refresh, CSRF protection, and realtime Socket.io — batteries included, fully typed.

Why rhttp.io?

  • Zero-boilerplate Secure, production-ready defaults via createClientHttp() and createServerHttp(). Credentials, JSON headers, CSRF, and observability are wired in for you.

  • Automatic cookie forwarding Server-side requests transparently forward incoming cookies, with TanStack Start auto-detection and an async_hooks store for custom frameworks.

  • Native TypeScript Strict types end to end. Typed responses, generics on every method, and a fully exported type surface so your editor always knows the shape of your data.

  • 5 caching strategies cache-first, network-first, cache-only, network-only, and stale-while-revalidate — plus ETag negotiation and per-request overrides.

  • Resilient by default Configurable retries with linear or exponential backoff, a circuit breaker, request pooling, deduplication, and a token-bucket rate limiter.

  • Realtime built-in A Socket.io client with rooms, offline queue, event validation, React hooks, and CSRF-aware connections — all under rhttp.io/socket.io.client.

Get going in seconds

📦 Install once, then import from the entry point that matches your environment.

npm i rhttp.io
import { createHttp } from "rhttp.io";
 
// Core client works everywhere — browser, Node, Edge.
const http = createHttp({
  baseURL: "https://api.example.com",
  defaultHeaders: { "Content-Type": "application/json" },
});
 
const { data } = await http.get<User>("/users/42");

Pick the right factory

  • createHttp() — framework-agnostic core. Use it when you want full control.
  • createClientHttp() — browser/Client Components. Adds credentials: "include", JSON headers, CSRF prefetch, and token auto-injection from localStorage.
  • createServerHttp() — Node/SSR. Enables cookie forwarding, tracing, and metrics out of the box.

Choose your features

Toggle caching, retries, circuit breaker, and observability via a single config object — or override any of them per request.

Explore the docs

Start with the Introduction →