High-Performance Multi-Protocol Asynchronous Rust HTTP/1.x · HTTP/2 · HTTP/3 Web Framework & Plugin Ecosystem
Tokio-Powered · Strict RFC 9110/9112 Wire Conformance · 40 Opt-In Zero-Overhead Plugins · Cross-Platform
API Docs · Quick Start · Workspace Architecture · Plugin Ecosystem · Benchmarks
Hyperlane is a high-performance asynchronous Rust web framework built on Tokio. It serves HTTP/1.0, HTTP/1.1, HTTP/2 (h2c/h2), HTTP/3 (QUIC), WebSocket, Server-Sent Events (SSE), gRPC, JSON-RPC, GraphQL, and Model Context Protocol (MCP) workloads with explicit lifecycle hooks, strict RFC 9110/9112 wire conformance, and 40 opt-in zero-overhead plugins across Linux, macOS, and Windows.
flowchart LR
App["User Service\nRoutes · Middleware · Hooks"] --> Facade["hyperlane\nFacade Crate"]
Facade --> Core["hyperlane-core\nHTTP/1.x · HTTP/2 · HTTP/3 · io_uring"]
Facade --> Macros["hyperlane-macros\n#[route] · #[send] · #[hyperlane]"]
Core --> Wire["http-type · http-constant · http-compress"]
App --> Plugins["40 Opt-In Plugins\nAuth · Cache · CORS · Gateway · GraphQL · gRPC · OpenAPI · Rate Limit ..."]
Plugins --> Client["http-request\nSync & Async H1/H2 Client"]
Tooling["hyperlane-cli (hyperlane fmt) · hyperlane-performance"] -.-> Facade
Create a Rust edition 2024 binary crate and add hyperlane:
cargo new hello-hyperlane
cd hello-hyperlane
cargo add hyperlaneReplace src/main.rs with:
use hyperlane::{Context, Server, ServerConfig, ServerError, ServerHook, Status, Stream, tokio};
const ADDRESS: &str = "127.0.0.1:3000";
const ROOT_PATH: &str = "/";
const GREETING: &str = "Hello from Hyperlane!\n";
struct Hello;
impl ServerHook for Hello {
async fn new(_: &mut Stream, _: &mut Context) -> Self {
Self
}
#[hyperlane::send]
async fn handle(self, stream: &mut Stream, ctx: &mut Context) -> Status {
ctx.get_mut_response().set_body(GREETING);
Status::Reject
}
}
#[tokio::main]
async fn main() -> Result<(), Box<ServerError>> {
let mut config: ServerConfig = ServerConfig::default();
config.set_address(ADDRESS);
let mut server: Server = Server::default();
server.server_config(config).route::<Hello>(ROOT_PATH);
let control = server.run().await?;
println!("Listening on http://{ADDRESS}");
control.wait().await;
Ok(())
}Run cargo run and query the endpoint:
curl -fsS http://127.0.0.1:3000/#[hyperlane::send] serializes and flushes the response built by the hook; Status::Reject stops the remaining pipeline so downstream hooks do not send a duplicate response.
All 49 crates share a unified version in root Cargo.toml (Rust edition 2024):
| Crate | Path | Responsibility |
|---|---|---|
hyperlane |
src/ |
Facade crate re-exporting hyperlane-core and hyperlane-macros |
hyperlane-core |
core/ |
Multi-protocol async server (HTTP/1.x, HTTP/2, HTTP/3), radix router, Context, ServerHook, Linux io_uring |
hyperlane-macros |
macros/ |
Procedural attribute macros (#[route], #[hyperlane], #[send], #[host], #[referer], middleware registration) |
http-type |
type/ |
RFC 9110/9112 wire parsers/builders, Request, Response, Stream, Cookie, WebSocket, Status, concurrent wrappers |
http-constant |
constant/ |
Zero-dependency canonical HTTP header, method, status, MIME, and protocol constants |
http-compress |
compress/ |
Bounded gzip, deflate, and brotli codecs (64 MiB cap) and Accept-Encoding negotiation |
http-request |
request/ |
Standalone sync & async HTTP/1.1 + HTTP/2 client with connection pooling, TLS resumption, retries, and proxy support |
hyperlane-cli |
cli/ |
Developer CLI (hyperlane fmt, watch, new, template) |
hyperlane-performance |
performance/ |
Reproducible CPU-pinned native & Docker loadgen and deterministic alloc-count benchmark harness |
Every plugin is opt-in and transparent (Status::Continue) when unconfigured (see the Plugin Catalog):
| Plugin Crate | Path | Responsibility |
|---|---|---|
hyperlane-plugin-audit |
plugin/audit/ |
Tamper-evident SHA-256 hash-chained audit trail, bounded ring buffer, pluggable AuditSink, header redaction |
hyperlane-plugin-auth |
plugin/auth/ |
Pure-Rust HS256 JWT (kid rotation), API key, HTTP Basic, RBAC AuthPrincipal, AuthHook |
hyperlane-plugin-body-limit |
plugin/body_limit/ |
Granular global, segment-bounded prefix, and MIME request payload size limits with prebuilt 413 responses |
hyperlane-plugin-cache |
plugin/cache/ |
64-way sharded bounded cache, single-flight coalescing, CacheRequestHook/CacheResponseHook |
hyperlane-plugin-canary |
plugin/canary/ |
Feature flags, A/B testing & deterministic XxHash3_64 basis-point sticky rollouts, X-Variant + Vary |
hyperlane-plugin-circuit-breaker |
plugin/circuit_breaker/ |
Route/prefix-scoped lock-free atomic sliding-window 5xx circuit breaker with half-open probe gating & 503 |
hyperlane-plugin-compression |
plugin/compression/ |
Full-duplex bounded request decompression (br/gzip/deflate) and Accept-Encoding response negotiation |
hyperlane-plugin-concurrency |
plugin/concurrency/ |
Lock-free atomic global & per-prefix in-flight concurrency limiter, RAII Context permits, load shedding 503 |
hyperlane-plugin-cors |
plugin/cors/ |
Precompiled zero-alloc CORS headers, origin policies, preflight OPTIONS, Vary merging |
hyperlane-plugin-env |
plugin/env/ |
Zero-dep .env parser, layered typed config loader, redacting SecretValue & HYPERLANE_* ServerConfig |
hyperlane-plugin-etag |
plugin/etag/ |
Automatic strong/weak XxHash3_64 ETag, zero-alloc If-None-Match (304) & If-Match (412) concurrency |
hyperlane-plugin-gateway |
plugin/gateway/ |
Reverse proxy & API gateway over pooled http-request with balancing, circuit breaker, GCRA limiter |
hyperlane-plugin-graphql |
plugin/graphql/ |
Zero-external-parser GraphQL over HTTP (POST/GET), depth/complexity DoS caps, XxHash3_64 resolver registry |
hyperlane-plugin-grpc |
plugin/grpc/ |
gRPC over HTTP/2 5-byte framing, bounded compression, status codes 0..=16, grpc-timeout |
hyperlane-plugin-health |
plugin/health/ |
/healthz, /livez, /readyz concurrent async probes, snapshot TTL cache, lock-free drain flag |
hyperlane-plugin-idempotency |
plugin/idempotency/ |
HTTP Idempotency-Key middleware, XxHash3_64 payload fingerprint, 64-shard replay store & in-flight lock |
hyperlane-plugin-ip-filter |
plugin/ip_filter/ |
Trusted-proxy right-to-left real IP extraction, /8 radix IPv4/IPv6 CIDR allow/denylist & prebuilt 403 |
hyperlane-plugin-logger |
plugin/logger/ |
Non-blocking buffered console/file logger with Plain/JSON formats and CRLF/ANSI sanitization |
hyperlane-plugin-maintenance |
plugin/maintenance/ |
Lock-free atomic live Active/ReadOnly/Maintenance gate, path/token bypasses, prebuilt 503 wire responses |
hyperlane-plugin-mcp |
plugin/mcp/ |
Streamable HTTP Model Context Protocol server with session TTLs and Origin DNS-rebinding guard |
hyperlane-plugin-metrics |
plugin/metrics/ |
Lock-free atomic counters, gauges, latency histograms, and Prometheus OpenMetrics /metrics endpoint |
hyperlane-plugin-mq |
plugin/mq/ |
Async MessageBroker trait and 64-shard InMemoryBroker with consumer groups, TTL, retries, DLQ |
hyperlane-plugin-multipart |
plugin/multipart/ |
Bounded RFC 7578 multipart/form-data guard, filename sanitization, magic-byte MIME sniffing & prebuilt errors |
hyperlane-plugin-negotiate |
plugin/negotiate/ |
Accept-Encoding compression and conditional 304 Not Modified ETag middlewares |
hyperlane-plugin-openapi |
plugin/openapi/ |
OpenAPI 3.1.0 spec builder, ETag-cached /openapi.json (304) & self-contained zero-CDN /docs explorer |
hyperlane-plugin-problem-details |
plugin/problem_details/ |
RFC 9457 (application/problem+json) error response builder and automatic 4xx/5xx normalizer |
hyperlane-plugin-rate-limit |
plugin/rate_limit/ |
64-way sharded lock-free atomic GCRA & fixed-window rate limiter with RFC RateLimit-* headers |
hyperlane-plugin-rewrite |
plugin/rewrite/ |
Zero-alloc URL normalization, HTTPS/canonical-host redirects, XxHash3_64 exact/prefix/regex rewrites |
hyperlane-plugin-rpc |
plugin/rpc/ |
JSON-RPC 2.0 XxHash3_64 router with concurrent batch/notification dispatch and payload caps |
hyperlane-plugin-scheduler |
plugin/scheduler/ |
Background async interval & 5-field UTC cron job scheduler with overlap guard, panic isolation & atomic metrics |
hyperlane-plugin-security |
plugin/security/ |
Prebuilt HSTS/CSP/COOP/COEP/CORP headers, stateless HMAC-SHA256 CSRF, host/URI/traversal guards |
hyperlane-plugin-session |
plugin/session/ |
64-shard bounded session store, HMAC-SHA256 signed cookies, dirty-tracked zero-write reads |
hyperlane-plugin-shutdown |
plugin/shutdown/ |
Graceful shutdown coordinator with SIGINT/SIGTERM arming, RAII drain guards, LIFO callbacks |
hyperlane-plugin-sse |
plugin/sse/ |
WHATWG SSE framing, CRLF sanitization, 64-way sharded topic pub/sub, Last-Event-ID replay |
hyperlane-plugin-static-files |
plugin/static_files/ |
Traversal-proof static server, MIME table, hot-file cache, .br/.gz sidecars, Range (206/416) |
hyperlane-plugin-tenant |
plugin/tenant/ |
Multi-tenant header/subdomain/path isolation, XxHash3_64 registry, TenantResolver & TenantContext |
hyperlane-plugin-timeout |
plugin/timeout/ |
Global & per-prefix request deadline budgets, X-Request-Timeout clamping, timeout_future & 504 conversion |
hyperlane-plugin-tracing |
plugin/tracing/ |
Lock-free 128-bit W3C Trace Context (traceparent/tracestate), X-Request-Id, Server-Timing |
hyperlane-plugin-webhook |
plugin/webhook/ |
Constant-time pure-Rust HMAC-SHA256 webhook verification (hex/base64/Stripe), skew guard & 64-shard replay cache |
hyperlane-plugin-websocket |
plugin/websocket/ |
Room-based WebSocket broadcast with lag recovery, lifecycle hooks, and opt-in WebSocketPlugin |
The performance workflow runs hyperlane-performance in a CPU-pinned Docker harness comparing baseline and candidate revisions in the same measurement window across h1, h1-tls, h2c, h2-tls, h3, and deterministic alloc-count.
- API Reference — Complete rustdoc reference on docs.rs.
- Plugin Ecosystem Guide — Hook execution order, configuration model, and all 40 official plugins.
- Production Starter Template — Ready-to-run service template (
hyperlane-quick-start). - Release Notes — Version history and protocol migration notes.
https://github.com/hyperlane-dev/hyperlane/pulls
This project is licensed under the MIT License. See the LICENSE file for details.
For inquiries, please contact the author at root@devhub.vip.