PACKAGE · HTTP CLIENT

undici

An HTTP/1.1 client, written from scratch for Node.js

WEEKLY DOWNLOADS 128.8M
STARS 7.7K
FORKS 818
OPEN ISSUES 326
GZIP SIZE 164.9 kB
UNPACKED SIZE 1.9 MB
DEPENDENCIES 0
LAST UPDATED 5mo ago
DOWNLOAD TRENDS

undici downloads — last 12 months

Download trends for undici1 download series from Aug 2025 to Jul 2026. Use left and right arrow keys to inspect monthly values.0143.8M287.6M431.3M575.1MAug 2025NovFebMayJul 2026
undici
ABOUT UNDICI

Undici is a high-performance HTTP/1.1 client designed from the ground up for Node.js, aiming to provide a modern and efficient alternative to the built-in 'http' module. It addresses common performance bottlenecks and API complexities found in Node.js's native client, offering a more predictable and resource-conscious way to handle network requests.

Its core philosophy revolves around delivering excellent performance with minimal overhead, making it suitable for I/O-intensive applications. The primary audience includes developers building scalable backend services, microservices, or any Node.js application that relies heavily on outbound HTTP communication. Undici prioritizes correctness and adherence to HTTP standards while pushing the boundaries of what's possible in a JavaScript runtime.

The client exposes a Promise-based API, facilitating modern asynchronous programming patterns. Key features include a pipeline API for efficient request/response handling, interceptors for request and response modification, and robust support for streams. This allows for fine-grained control over the request lifecycle, enabling developers to implement custom logic for caching, authentication, or error handling.

Undici is designed to integrate seamlessly into existing Node.js workflows and frameworks. It can be used directly in any Node.js project or within popular frameworks like Fastify, which has adopted it as its default HTTP client. Its stream-based architecture also makes it compatible with Node.js's stream ecosystem, enabling efficient data transfer for large payloads.

With a bundle size of 164.9 kB (gzipped), Undici offers a significant improvement over larger HTTP clients, though it is larger than the Node.js built-in module. It has achieved remarkable adoption, evidenced by 128.8 million weekly downloads, indicating a mature and stable solution for enterprise-level applications.

While Undici is a robust client, developers should be aware that it doesn't include features like automatic retries or complex connection pooling out-of-the-box, which might be present in some third-party abstractions. For scenarios requiring extensive configuration of pooling or sophisticated retry logic, additional wrapper logic or libraries might be necessary, although Undici provides the foundational capabilities.

WHEN TO USE
  • When needing to implement efficient HTTP request pipelines for services with high request volumes.
  • When developing Node.js applications that require fine-grained control over request and response streams.
  • When integrating with frameworks like Fastify that leverage Undici as their default HTTP client.
  • When seeking a Promise-based alternative to Node.js's built-in 'http' module for cleaner async code.
  • When building microservices that prioritize low-latency communication and efficient resource utilization.
  • When implementing custom request or response interceptors for cross-cutting concerns like authentication or logging.
WHEN NOT TO USE
  • If your application solely requires basic GET requests without complex error handling or streaming, the built-in 'http' module might suffice with less overhead.
  • If you require an all-in-one HTTP client solution with built-in automatic retry mechanisms and complex pooling logic, consider a higher-level abstraction.
  • When targeting environments where minimal bundle size is the absolute highest priority and Node.js built-in modules are heavily preferred.
  • If your project's HTTP needs are extremely simple and do not benefit from advanced features like stream handling or interceptors.
  • When you need to support older Node.js versions that lack the necessary APIs for Undici's Promise-based or stream functionalities.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 6
undici vs ky ★ 17.0K · 6.0M/wk undici vs got ★ 14.9K · 32.4M/wk undici vs axios ★ 109.2K · 98.0M/wk undici vs superagent ★ 16.6K · 19.1M/wk undici vs node-fetch ★ 8.9K · 149.0M/wk undici vs ofetch ★ 5.3K · 21.5M/wk