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()andcreateServerHttp(). 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_hooksstore 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, andstale-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.ioimport { 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. Addscredentials: "include", JSON headers, CSRF prefetch, and token auto-injection fromlocalStorage.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.