PACKAGE · HTTP CLIENT

undici

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

WEEKLY DOWNLOADS 197.6M
STARS 7.7K
FORKS 904
OPEN ISSUES 379
GZIP SIZE 168.3 kB
UNPACKED SIZE 1.9 MB
DEPENDENCIES 0
LAST UPDATED 7mo ago
DOWNLOAD TRENDS

undici downloads · last 12 months

Download trends for undici1 download series from Oct 2025 to Sep 2026. Use left and right arrow keys to inspect monthly values.0192.6M385.1M577.7M770.2MOct 2025JanAprJulSep 2026
undici
ABOUT UNDICI

Undici is a complete rewrite of Node.js's built-in HTTP/1.1 client, focusing on performance and a modern API. It addresses limitations in the native `http` and `https` modules, offering improved throughput and a more predictable developer experience for network requests. This package aims to provide a robust foundation for any application requiring efficient and reliable HTTP communication within the Node.js ecosystem.

The core philosophy behind Undici is to build a high-performance, spec-compliant HTTP client from the ground up. It targets Node.js developers who require fine-grained control over network operations and seek to minimize overhead. The design prioritizes efficiency, correctness, and a clear, composable API, making it suitable for both high-concurrency servers and demanding client-side applications.

Undici exposes a functional API, emphasizing stream-based processing and request/response pipelining. Key features include a `request` function for initiating HTTP requests, interceptors for modifying requests and responses globally, and a robust pool management system. It also provides `pipeline` for efficient multiplexing of requests over a single connection and `ProxyAgent` for handling proxy configurations seamlessly.

This client integrates well into various Node.js frameworks and tools. It can be used directly in plain Node.js applications, or within frameworks like Express.js or Fastify when making outgoing HTTP calls. Its stream-based nature also makes it compatible with asynchronous iteration patterns, fitting into modern JavaScript workflows that rely on `async/await` and generators.

With a weekly download count of 98.5 million, Undici demonstrates significant adoption and is actively maintained, as indicated by its last update in September 2026. Its unpacked size of 1.9 MB and gzipped bundle size of 168.3 kB are moderate for a comprehensive HTTP client, striking a balance between feature richness and footprint.

While Undici offers a powerful and efficient client, developers should be aware that its API differs from the legacy `http` module. Migrating existing codebases may require adjustments to how requests are initiated and responses are handled, particularly concerning error handling and stream management. It's essential to consult the documentation for proper integration and to leverage its full capabilities.

WHEN TO USE
  • When building Node.js applications that require efficient and high-throughput HTTP/1.1 client capabilities.
  • For scenarios demanding fine-grained control over request/response streams and connection pooling.
  • When needing to implement advanced HTTP features like request interception or response streaming.
  • For integrating with microservices or external APIs where reliable and performant communication is critical.
  • When leveraging asynchronous iteration patterns for processing large response bodies.
  • For modernizing existing Node.js applications by replacing the legacy `http` or `https` modules with a more performant alternative.
WHEN NOT TO USE
  • If your application's HTTP client needs are minimal and primarily involve simple GET requests without complex headers or bodies, the native `http` module might suffice.
  • When a significantly smaller bundle size is an absolute requirement and the features of Undici are not fully utilized.
  • If maintaining strict compatibility with older Node.js versions that do not support its API surface is a primary concern.
  • For basic JSON-to-JSON API calls where simpler, more specialized libraries might offer a quicker setup.
  • When the complexity of managing stream-based APIs and error handling in Undici outweighs the benefits for straightforward network interactions.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 6
undici vs ofetch ★ 5.4K · 28.2M/wk undici vs superagent ★ 16.6K · 22.9M/wk undici vs ky ★ 17.1K · 6.9M/wk undici vs got ★ 14.9K · 40.7M/wk undici vs axios ★ 109.2K · 113.9M/wk undici vs node-fetch ★ 8.9K · 202.4M/wk