Guide · Open source
How to use hyper: install the Rust HTTP library and get started
Updated · written with AI from the project's own documentation and checked against our catalogue data
hyper is an HTTP library written in Rust. It supports HTTP/1 and HTTP/2 and offers both client and server APIs, and it is designed to be a building block for other libraries and applications. This guide explains how to add hyper to a Rust project, what it is suited for, and when a higher-level option such as reqwest, axum or warp is a better fit.
Quick start
- 1Check your Rust toolchain. Make sure Rust and Cargo are installed, since hyper is a Rust library that Cargo manages.
- 2Open your Rust project. Change into the directory of the Rust project that needs an HTTP layer.
- 3Add hyper. Run cargo add hyper to add the crate as a dependency.
- 4Read the guides. Open the guides at hyper.rs to learn the client and server APIs.
- 5Decide if you need a higher-level tool. If you want a simpler client, consider reqwest. If you want a server framework, consider axum or warp.
What hyper is and who it is for
hyper is an asynchronous HTTP library for Rust. According to its README, it supports HTTP/1 and HTTP/2 and provides both Client and Server APIs.
The README describes hyper as relatively low-level and meant to be a building block for libraries and applications. It is a good fit for Rust developers who need fine control over HTTP behavior, for authors of libraries or frameworks that need an HTTP layer, and for teams building services that need HTTP/1 and HTTP/2 in Rust.
- HTTP/1 and HTTP/2 support
- Asynchronous design
- Client and Server APIs
- Licensed under MIT
What you need before installing hyper
hyper is a Rust library, so you need a Rust toolchain with Cargo, Rust's package manager. The install method listed for hyper is a package manager, and the README gives the command below to add it to a project.
hyper is not meant for non-Rust projects.
- A Rust toolchain (Cargo)
- An existing Rust project, or create one with Cargo first
Install hyper in a Rust project
Change into your Rust project directory and run the command from the README. Cargo adds hyper as a dependency of your project.
Then import hyper from your Rust code as you would any crate.
cargo add hyperChoose between hyper, reqwest and a server framework
Because hyper is low-level, the README points to other projects for common tasks. If you want a convenient HTTP client, the README suggests reqwest. If you are not sure which HTTP server to use, it suggests axum or warp, with warp taking a more functional approach. Both axum and warp are built on top of hyper.
If you only want a ready-made web server without writing code, hyper alone is not the right starting point.
- Convenient HTTP client: reqwest
- HTTP server framework: axum or warp (both built on hyper)
- Low-level control or building your own library: hyper
Learn more and contribute
The README points to the hyper guides at hyper.rs as the place to get started, and to the Discord server for community chat. Contribution guidelines are in CONTRIBUTING.md in the repository.
The project is licensed under the MIT license, described in the LICENSE file.
- Guides: https://hyper.rs/guides/1/
- Contributing: CONTRIBUTING.md
- License: MIT (see LICENSE)
What people use it for
- Building an HTTP layer for a Rust library or framework
- Writing a custom HTTP client or server that needs HTTP/1 and HTTP/2 support
- Adding low-level HTTP control to a Rust service
Frequently asked questions
How do I install hyper?
In a Rust project, run cargo add hyper. The README gives this command, and it requires a Rust toolchain with Cargo.
Is hyper free to use?
hyper is provided under the MIT license, according to its README and LICENSE file. See the repository for the full license text.
Does hyper support HTTP/2?
Yes. The README lists HTTP/1 and HTTP/2 support along with both client and server APIs.
Is hyper good for beginners?
Not usually. The README calls hyper relatively low-level and recommends reqwest if you want a convenient HTTP client.
What is the difference between hyper and reqwest?
hyper is a low-level building block, while reqwest is the convenient client the README suggests for most users. reqwest is not described in the source as built on hyper, so check its own documentation for that.
What should I use instead of hyper to build a web server?
The README suggests axum or warp if you are not sure which HTTP server to choose. Both are built on top of hyper, and warp takes a more functional approach.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
hyper is a good choice for Rust developers and library authors who need fine control over HTTP/1 and HTTP/2 client or server behavior. If you want a simple HTTP client or a ready-made web server, the README points you toward reqwest, axum or warp instead.
Install options & downloads