PACKAGE · HTTP CLIENT

undici

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

WEEKLY DOWNLOADS 60.2M
STARS 7.6K
FORKS 775
OPEN ISSUES 305
GZIP SIZE 174.8 kB
UNPACKED SIZE 1.6 MB
DEPENDENCIES 1
LAST UPDATED 3mo ago
DOWNLOAD TRENDS

undici downloads — last 12 months

Download trends for undici1 download series from Jun 2025 to May 2026. Use left and right arrow keys to inspect monthly values.0116.4M232.8M349.1M465.5MJun 2025SepDecMarMay 2026
undici
ABOUT UNDICI

Undici is a modern, high-performance HTTP/1.1 client specifically engineered for Node.js. It addresses the need for a more efficient and spec-compliant HTTP implementation within the Node.js ecosystem, aiming to replace the built-in `http` and `https` modules for many use cases. Its design prioritizes performance and developer experience, offering a cleaner API.

The core philosophy behind Undici is to provide a fast, reliable, and robust HTTP client by leveraging modern JavaScript features and a ground-up rewrite. It targets Node.js developers who require fine-grained control over HTTP requests and responses, as well as those looking for better performance characteristics compared to the legacy modules. The project acknowledges the existing HTTP client in Node.js but offers a distinct and improved implementation.

Undici's API is designed around Promises and async/await, making asynchronous operations more straightforward. Key patterns include a fluent builder-style API for constructing requests and a robust stream-based approach for handling request bodies and response bodies. Specific APIs like `undici.request()` and `undici.fetch()` expose its capabilities, allowing for easy integration into existing Node.js applications with minimal boilerplate.

This client is designed to integrate seamlessly into various Node.js workflows and frameworks. It can be used independently or as a replacement for the native `http` module in server frameworks, CLI tools, or background job processors. Its compatibility with the `fetch` API standard also simplifies migration for developers familiar with browser-based fetch operations, bridging the gap between client and server-side HTTP handling.

Undici is notably efficient, with a relatively small unpacked size of 1.6 MB and a gzipped bundle size of 174.8 kB, making it suitable for performance-sensitive applications. While it aims for high performance, developers should be aware that its comprehensive feature set and modern approach might introduce a slightly larger footprint than extremely minimal alternatives, though this is a deliberate trade-off for its capabilities and speed.

Developers should note that Undici is a third-party package and not part of the Node.js core modules, requiring explicit installation. While it strives for broad compatibility, extremely specific or legacy HTTP behaviors that rely on the intricacies of the older Node.js `http` module might require careful testing during migration. Its active development, indicated by frequent updates and a significant number of open issues (311), suggests a dynamic project lifecycle.

WHEN TO USE
  • When building a Node.js application that requires making numerous HTTP requests and needs optimal performance.
  • When you need to leverage the `fetch` API standard in a Node.js environment with a more capable implementation than the experimental built-in.
  • When migrating existing Node.js HTTP client code to a more modern, Promise-based, and efficient interface.
  • When developing server-side applications that need to act as robust HTTP clients, consuming external APIs.
  • When fine-grained control over HTTP request/response streams and headers is critical for application logic.
  • When the performance characteristics and explicit API design of Undici align with project requirements for speed and maintainability.
WHEN NOT TO USE
  • If your application exclusively relies on the legacy callback-style API of Node.js's built-in `http` module and backward compatibility is paramount.
  • If you require an HTTP client that is guaranteed to be available globally without any external dependencies in all Node.js environments.
  • When a significantly smaller dependency footprint is a primary concern, and a minimal set of HTTP features suffices.
  • If your use case involves complex mocking for testing and the existing Jest or node-mocks-http integrations with native `http` are easier to manage than setting up Undici mocks.
  • For extremely simple, one-off HTTP requests where the overhead of requiring and configuring Undici outweighs the benefits of its advanced features.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 6
undici vs ky ★ 16.9K · 2.9M/wk undici vs got ★ 14.9K · 17.0M/wk undici vs ofetch ★ 5.3K · 9.0M/wk undici vs superagent ★ 16.6K · 9.8M/wk undici vs axios ★ 109.1K · 55.4M/wk undici vs node-fetch ★ 8.9K · 73.5M/wk