HTTP Clients (Server-side)
Making outbound HTTP requests from Node, Bun, Deno, Workers.
Built-in / native
- ★
fetch— built into Node 18+, Bun, Deno, Workers, browsers. The default. undici— Node'sfetchis built on this; you can use it directly forPool,Agent, mocking, retry interceptors. The default for performance-sensitive Node code.- Bun's
fetch— drop-in compatible, very fast. Request/Response/Headers— standard now; same code works on Node + Workers + Deno.
Lightweight wrappers around fetch
- ★ ofetch (UnJS) — auto-JSON, retries, hooks, error class with
data, query helpers. Used by Nuxt / Nitro; works everywhere fetch does. Default if you want a tiny ergonomic wrapper. - ★ ky — promise-based, retries, hooks, timeouts, instances. Default if you've used
axiosand want lighter. - redaxios —
axiosAPI in 800 bytes via fetch. - wretch — chainable fetch wrapper.
Heavier / older
- axios — still huge install base; bigger bundle; use ky / ofetch for new code.
- got — Node-only, very feature-rich (timeouts, hooks, streams, retries); heavier than ofetch.
- node-fetch — pre-built-in-fetch era; mostly retired.
- request — deprecated; do not use.
Specialized
- gRPC clients —
@grpc/grpc-js(Node),nice-grpc,connect-rpc(HTTP+gRPC bridge). - WebSocket clients —
ws(Node), built-inWebSocket(browsers / Workers / Bun / Deno). - Server-Sent Events — built-in
EventSource;eventsource-parserfor streaming LLM responses. - GraphQL clients — see Data Fetching.
Mocking / testing
- ★ MSW (Mock Service Worker) — intercept fetch in tests / dev / Storybook with the same mocks. Default.
- nock — older; Node-specific HTTP interceptor.
undici'sMockAgent— built-in forundici/ Nodefetch.- Polly.js — record / replay HTTP.
Generated clients (typed from spec)
openapi-fetch+openapi-typescript— typed fetch from any OpenAPI.- Hey API — full TS clients from OpenAPI; see OpenAPI Tooling.
- GraphQL Code Generator — typed GraphQL clients.
- gql.tada — type-safe GraphQL via type-only inference.
Pick this if…
- Default new code:
fetchdirectly, orofetch/kyfor ergonomics. - Performance-sensitive Node:
undicidirectly. - Migrating off axios: ky.
- Typed client from a third-party API:
openapi-fetch+openapi-typescript. - Mocking in tests: MSW.