undici

A fast, spec-compliant HTTP/1.1 client for Node.js, built from scratch with zero runtime dependencies

Library
npm
v8.12.3
7,719 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
92 /100 Excellent
Development Activity 100
Maintenance 96
Community 72
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
87 /100 Excellent
Architecture 90
Code Quality 92
Innovation 88
Learning Curve 78

Undici is the HTTP/1.1 client that powers Node.js’s built-in fetch(), written from scratch by the Node.js core team rather than wrapping the legacy http module. It exposes both a low-level, high-throughput request/stream/pipeline/dispatch API and a spec-compliant fetch() implementation, giving developers fine-grained control over connection pooling, keep-alive, and timeouts without sacrificing standards compliance.

Beyond basic requests, undici ships production features out of the box: a Cache interceptor with pluggable stores, MockAgent for deterministic testing, ProxyAgent/Socks5ProxyAgent/EnvHttpProxyAgent for proxied traffic, retry and redirect handlers, WebSocket and EventSource clients, and HTTP/2 support via H2CClient. Because it has no runtime dependencies and is maintained inside the Node.js org, it tracks platform standards closely and is the reference implementation many other libraries build on.

What You Get

  • A spec-compliant fetch() implementation plus low-level request, stream, pipeline, and dispatch APIs for maximum throughput
  • Agent, Pool, BalancedPool, and RoundRobinPool dispatchers for fine-grained connection-pool and keep-alive configuration
  • Built-in Cache interceptor with a pluggable MemoryCacheStore (and custom store support) that follows HTTP caching semantics
  • MockAgent and SnapshotAgent for writing deterministic, network-free tests against real request/response shapes
  • ProxyAgent, Socks5ProxyAgent, and EnvHttpProxyAgent for routing traffic through HTTP or SOCKS5 proxies
  • Native WebSocket and EventSource client implementations, plus HTTP/2 support through H2CClient
  • Composable interceptors (retry, redirect, dump, dns, decompress, deduplicate, cache) for building request middleware pipelines

Common Use Cases

  • Replacing Node’s built-in http/https modules or node-fetch in server-side code that needs higher throughput and lower overhead
  • Calling external APIs from a Node.js backend or serverless function with connection pooling and keep-alive tuned per host
  • Mocking outbound HTTP calls in unit and integration tests via MockAgent instead of a separate network-mocking library
  • Building an HTTP client with response caching (via the cache interceptor) for services that repeatedly hit the same upstream endpoints
  • Routing outbound requests through corporate HTTP or SOCKS5 proxies in enterprise network environments

Under The Hood

Architecture — Undici is organized around a Dispatcher base class (lib/dispatcher/dispatcher-base.js) that Client, Pool, BalancedPool, RoundRobinPool, and Agent all extend; the top-level API methods (request, stream, pipeline, connect, upgrade) live in lib/api/ and are mixed onto Dispatcher.prototype in index.js. A single Client (lib/dispatcher/client.js, ~700 lines) owns one origin’s socket(s), tracking pending/running request queues via symbol-keyed internal state (kPending, kRunning, kQueue, kPipelining) and building the actual net/tls connection through buildConnector in lib/core/connect.js. Handlers (RetryHandler, RedirectHandler, DecoratorHandler) and composable interceptors (retry, redirect, cache, dns, decompress, deduplicate) wrap dispatch calls to add cross-cutting behavior without touching the core client, and MockAgent/SnapshotAgent in lib/mock/ implement the same Dispatcher interface so mocked and real traffic are interchangeable from the caller’s perspective.

Tech Stack — The package has zero runtime dependencies, deliberately reimplementing HTTP parsing, connection management, and even a WHATWG-compliant fetch/Headers/FormData/WebSocket/EventSource layer (lib/web/) on top of Node’s raw net/tls/http2 modules rather than depending on http. It requires Node.js >=22.19.0 and ships hand-written TypeScript declaration files (types/*.d.ts, checked with tsd) alongside the JavaScript source; the build pipeline uses esbuild to produce a bundled undici-fetch.js and a WASM build step for llhttp-based parsing (lib/llhttp/).

Code Quality — The test suite spans 409 files under test/ covering unit behavior, WPT (Web Platform Tests) conformance for fetch/WebSocket/EventSource, fuzzing, cache and cache-interceptor behavior, cookies, and Node’s own node:test runner integration, run via borp and c8 for coverage (configured in .c8rc.json against lib/**/*.js and index.js). Errors are centralized in lib/core/errors.js as named classes (e.g. InvalidArgumentError, ClientDestroyedError) rather than raw thrown strings, and internal state is consistently namespaced with Symbol() keys (kUrl, kConnect, kBusy, etc.) to avoid leaking private fields onto public prototypes.

API Design — The library deliberately offers two tiers: a low-level dispatch/request/stream/pipeline surface for teams that want maximum control and performance, and a drop-in, spec-compliant fetch() for teams that want Web-standard ergonomics with import { fetch } from 'undici'. Global installation via install() swaps in undici’s own fetch, Headers, Response, Request, FormData, and WebSocket, which keeps FormData/fetch pairing correct — a common footgun the docs call out explicitly. Getting started requires a single import and no configuration for the common path (await request(url)), while advanced features (proxies, caching, mocking, retries) are opt-in via constructor options or composable interceptors rather than being forced on every user.

Used by 70 apps in this directory

Go
33%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

13,023

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
84
Repo Health
88
Technical
63
Dependency
Built with
Go 33%
Rust 26%
C 22%
Updated 6 days ago
TypeScript
96%
MIT

deepseek-harness

AI Agents · AI Development · Developer Tools

259,694

An open-source, plugin-based agent harness from DeepSeek AI that runs coding and automation agents across web, desktop, CLI, and SDK surfaces.

View details
82
Repo Health
89
Technical
73
Dependency
Built with
TypeScript 96%
Updated 6 days ago
Python
56%
Other

Dify

AI Development · Design Tools · Developer Tools

159,396

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
67
Dependency
Built with
Python 56%
TypeScript 42%
Updated 5 days ago
TypeScript
80%
Other

Directus

CMS · Low Code Platforms

38,629

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

View details
93
Repo Health
82
Technical
76
Dependency
Built with
TypeScript 80%
Vue 19%
Updated 6 days ago
TypeScript
95%
AGPL 3.0

Docmost

CMS · Collaboration · Note Taking

22,079

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
66
Dependency
Built with
TypeScript 95%
Updated 5 days ago
TypeScript
98%
Other

Dokploy

Devops · Hosting Control Panel · Security

37,989

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
89
Repo Health
76
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
96%
Other

Dyad

AI Assistants · AI Code Assistants · AI Development

22,046

Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.

View details
87
Repo Health
83
Technical
69
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
91%
Other

FastGPT

AI Agents · AI Development

29,900

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 91%
Updated 5 days ago
TypeScript
74%
Apache 2.0

Fern

Developer Tools

3,822

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 74%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers