Description: An HTTP/1.1 client, written from scratch for Node.js
View nodejs/undici on GitHub ↗
Undici is a brand-new, modern HTTP/2 and HTTP/3 client for Node.js, developed as a direct replacement for the deprecated `request` module. It’s a significant departure in design and philosophy, aiming for simplicity, performance, and a more robust experience for developers. Unlike `request`, which was built on top of the older `http` and `https` modules, Undici is built from the ground up using modern Node.js features and a focus on asynchronous programming. The core goal of the project is to provide a reliable and performant HTTP client that aligns with the current standards and best practices of the Node.js ecosystem.
**Key Features and Design Choices:**
* **HTTP/2 and HTTP/3 Support:** Undici natively supports both HTTP/2 and HTTP/3, offering the latest in web protocol efficiency. This is a crucial upgrade from `request`, which only supported HTTP/1.1. * **Asynchronous API:** Undici utilizes a fully asynchronous API, leveraging Promises and async/await for cleaner and more manageable code. This eliminates callback hell and improves readability. * **TypeScript First:** The project was initially developed in TypeScript, and the codebase remains primarily in TypeScript. This provides strong typing, improved code maintainability, and better tooling support. * **Minimal Dependencies:** Undici has a very small number of dependencies, reducing the overall size of the project and simplifying deployment. * **Modern Error Handling:** The project employs a more robust and consistent error handling system, making it easier to diagnose and resolve issues. * **No External Dependencies for Core Functionality:** The core HTTP client functionality relies solely on Node.js's built-in `net` module, avoiding the need for external libraries for fundamental operations.
**Development and Community:**
The Undici project is actively maintained by the Node.js core team and a growing community of contributors. It’s a community-driven effort, and contributions are highly encouraged. The project is hosted on GitHub, with a well-documented repository containing examples, tutorials, and a comprehensive API reference. The project is under active development, with frequent releases and ongoing improvements.
**Migration from `request`:**
Undici is designed to be a drop-in replacement for `request`. The API is largely compatible, making migration relatively straightforward. However, developers should carefully review the documentation and examples to ensure a smooth transition. The project provides clear migration guides to help users understand the differences and best practices for using Undici.
**Future Directions:**
The Undici project is continuously evolving, with plans for further enhancements, including support for WebSockets, more advanced features, and improved performance. The team is committed to building a high-quality, reliable, and performant HTTP client for the Node.js ecosystem.
Fetching additional details & charts...