⚡The Ultimate Choice for Building Modern Web Services: A Lightweight Rust HTTP Framework
In today’s digital era, building high-performance and reliable web services is a goal pursued by every developer. Today, we are proud to introduce Hyperlane, a lightweight and high-performance Rust HTTP server library designed to simplify your web service development. Project Overview Hyperlane is built entirely with pure Rust and the standard library, offering true cross-platform compatibility across Windows, Linux, and macOS—with consistent API behavior on all platforms. It leverages the asynchronous Tokio runtime to enable seamless network communication without platform-specific dependencies. Key Features: Supports HTTP request parsing, response construction, and TCP communication. Built-in support for request/response middleware, WebSocket, and Server-Sent Events (SSE) for efficient and flexible real-time communication. Simple and intuitive API design that allows developers to quickly build modern web services. Getting Started To get started with Hyperlane, add it to your project using the following command: cargo add hyperlane We also provide a quick start project, hyperlane-quick-start, to help you set up and run your first Hyperlane application quickly. Clone the project: git clone https://github.com/eastspire/hyperlane-quick-start.git Navigate to the project directory: cd hyperlane-quick-start Run the project: cargo run You can also choose to run it in the background, stop, or restart the service: # Run in background cargo run -d # Stop the service cargo run stop # Restart the service cargo run restart # Restart in background cargo run restart -d Example Usage Below is a simple Hyperlane application demonstrating how to set up middleware, routes, and WebSocket support: use hyperlane::*; async fn request_middleware(ctx: Context) { let socket_addr: String = ctx.get_socket_addr_or_default_string().await; ctx.set_response_header(SERVER, HYPERLANE) .await .set_response_header(CONNECTION, CONNECTION_KEEP_ALIVE) .await .set_response_header(CONTENT_TYPE, TEXT_PLAIN) .await .set_response_header("SocketAddr", socket_addr) .await; } async fn response_middleware(ctx: Context) { let _ = ctx.send().await; } async fn root_route(ctx: Context) { ctx.set_response_status_code(200) .await .set_response_body("Hello hyperlane => /") .await; } async fn websocket_route(ctx: Context) { let request_body: Vec = ctx.get_request_body().await; let _ = ctx.send_response_body(request_body).await; } fn error_handle(error: String) { eprintln!("{}", error); let _ = std::io::Write::flush(&mut std::io::stderr()); } #[tokio::main] async fn main() { let server: Server = Server::new(); server.host("0.0.0.0").await; server.port(60000).await; server.enable_nodelay().await; server.disable_linger().await; server.http_line_buffer_size(4096).await; server.websocket_buffer_size(4096).await; server.error_handle(error_handle).await; server.request_middleware(request_middleware).await; server.response_middleware(response_middleware).await; server.route("/", root_route).await; server.route("/websocket", websocket_route).await; server .route("/test/:text", move |ctx: Context| async move { let param: RouteParams = ctx.get_route_params().await; panic!("Test panic {:?}", param); }) .await; server.run().await.unwrap(); } Performance Benchmark We benchmarked Hyperlane to demonstrate its excellent performance using the wrk and ab tools. Below are the results: wrk Benchmark Command: wrk -c360 -d60s http://127.0.0.1:60000/ Results: Rank Framework QPS 1 Tokio 340,130.92 2 Hyperlane 324,323.71 3 Rocket 298,945.31 4 Rust stdlib 291,218.96 5 Gin 242,570.16 6 Go stdlib 234,178.93 7 Node stdlib 139,412.13 ab Benchmark Command: ab -n 1000000 -c 1000 -r -k http://127.0.0.1:60000/ Results: Rank Framework QPS 1 Tokio 308,596.26 2 Hyperlane 307,568.90 3 Rocket 267,931.52 4 Rust stdlib 260,514.56 5 Go stdlib 226,550.34 6 Gin 224,296.16 7 Node stdlib 85,357.18 License & Contribution Hyperlane is released under the MIT license. For more information, please refer to the license file. We welcome contributions from the community! You can get involved by submitting issues or opening pull requests. If you have any questions or need further assistance, feel free to contact the author: root@ltpp.vip. Choose Hyperlane — choose the future of high-performance and elegant web service development. Start your development journey now and experience the speed and simplicity that Hyperlane brings!

In today’s digital era, building high-performance and reliable web services is a goal pursued by every developer. Today, we are proud to introduce Hyperlane, a lightweight and high-performance Rust HTTP server library designed to simplify your web service development.
Project Overview
Hyperlane is built entirely with pure Rust and the standard library, offering true cross-platform compatibility across Windows, Linux, and macOS—with consistent API behavior on all platforms. It leverages the asynchronous Tokio runtime to enable seamless network communication without platform-specific dependencies.
Key Features:
- Supports HTTP request parsing, response construction, and TCP communication.
- Built-in support for request/response middleware, WebSocket, and Server-Sent Events (SSE) for efficient and flexible real-time communication.
- Simple and intuitive API design that allows developers to quickly build modern web services.
Getting Started
To get started with Hyperlane, add it to your project using the following command:
cargo add hyperlane
We also provide a quick start project, hyperlane-quick-start, to help you set up and run your first Hyperlane application quickly.
Clone the project:
git clone https://github.com/eastspire/hyperlane-quick-start.git
Navigate to the project directory:
cd hyperlane-quick-start
Run the project:
cargo run
You can also choose to run it in the background, stop, or restart the service:
# Run in background
cargo run -d
# Stop the service
cargo run stop
# Restart the service
cargo run restart
# Restart in background
cargo run restart -d
Example Usage
Below is a simple Hyperlane application demonstrating how to set up middleware, routes, and WebSocket support:
use hyperlane::*;
async fn request_middleware(ctx: Context) {
let socket_addr: String = ctx.get_socket_addr_or_default_string().await;
ctx.set_response_header(SERVER, HYPERLANE)
.await
.set_response_header(CONNECTION, CONNECTION_KEEP_ALIVE)
.await
.set_response_header(CONTENT_TYPE, TEXT_PLAIN)
.await
.set_response_header("SocketAddr", socket_addr)
.await;
}
async fn response_middleware(ctx: Context) {
let _ = ctx.send().await;
}
async fn root_route(ctx: Context) {
ctx.set_response_status_code(200)
.await
.set_response_body("Hello hyperlane => /")
.await;
}
async fn websocket_route(ctx: Context) {
let request_body: Vec<u8> = ctx.get_request_body().await;
let _ = ctx.send_response_body(request_body).await;
}
fn error_handle(error: String) {
eprintln!("{}", error);
let _ = std::io::Write::flush(&mut std::io::stderr());
}
#[tokio::main]
async fn main() {
let server: Server = Server::new();
server.host("0.0.0.0").await;
server.port(60000).await;
server.enable_nodelay().await;
server.disable_linger().await;
server.http_line_buffer_size(4096).await;
server.websocket_buffer_size(4096).await;
server.error_handle(error_handle).await;
server.request_middleware(request_middleware).await;
server.response_middleware(response_middleware).await;
server.route("/", root_route).await;
server.route("/websocket", websocket_route).await;
server
.route("/test/:text", move |ctx: Context| async move {
let param: RouteParams = ctx.get_route_params().await;
panic!("Test panic {:?}", param);
})
.await;
server.run().await.unwrap();
}
Performance Benchmark
We benchmarked Hyperlane to demonstrate its excellent performance using the wrk
and ab
tools. Below are the results:
wrk Benchmark
Command:
wrk -c360 -d60s http://127.0.0.1:60000/
Results:
Rank | Framework | QPS |
---|---|---|
1 | Tokio | 340,130.92 |
2 | Hyperlane | 324,323.71 |
3 | Rocket | 298,945.31 |
4 | Rust stdlib | 291,218.96 |
5 | Gin | 242,570.16 |
6 | Go stdlib | 234,178.93 |
7 | Node stdlib | 139,412.13 |
ab Benchmark
Command:
ab -n 1000000 -c 1000 -r -k http://127.0.0.1:60000/
Results:
Rank | Framework | QPS |
---|---|---|
1 | Tokio | 308,596.26 |
2 | Hyperlane | 307,568.90 |
3 | Rocket | 267,931.52 |
4 | Rust stdlib | 260,514.56 |
5 | Go stdlib | 226,550.34 |
6 | Gin | 224,296.16 |
7 | Node stdlib | 85,357.18 |
License & Contribution
Hyperlane is released under the MIT license. For more information, please refer to the license file.
We welcome contributions from the community! You can get involved by submitting issues or opening pull requests.
If you have any questions or need further assistance, feel free to contact the author: root@ltpp.vip.
Choose Hyperlane — choose the future of high-performance and elegant web service development. Start your development journey now and experience the speed and simplicity that Hyperlane brings!