h3-axum

Crates.ioh3-axum
lib.rsh3-axum
version0.2.0
created_at2025-10-29 00:56:02.014341+00
updated_at2025-11-28 16:13:46.804213+00
descriptionTransport your Axum router over HTTP/3. Use your existing handlers with QUIC.
homepage
repositoryhttps://github.com/iadev09/h3-axum
max_upload_size
id1905861
size65,944
(iadev09)

documentation

README

h3-axum

Direct h3 → Axum. No middleman. Just an adapter.

With HTTP/3, the web is a transport, not just a verbs API.


The Problem

🧭 You have an Axum router. You want HTTP/3.

Write your own h3 ↔ Axum adapter.
Handle body conversions, protocol details, error cases.


The Solution 🛠️

// 1. Your Axum router (unchanged)
let app = Router::new()
.route("/users", get(list_users));

// 2. Standard HTTP/3 setup (h3 + quinn)
let h3_conn = h3::server::builder()
.build(h3_quinn::Connection::new(conn))
.await?;

// 3. Bridge h3 → Axum (one line)
h3_axum::serve_h3_with_axum(app, resolver).await?;

That's it. Direct h3 → Axum.


What h3-axum Provides

Just the adapter:

// Bridge h3 ↔ Axum
h3_axum::serve_h3_with_axum(app, resolver).await?;

// Distinguish graceful closes from errors
if h3_axum::is_graceful_h3_close( & err) { /* ... */ }

That's the entire library.


Example ▶️

Complete working server in examples/server.rs:

  • Axum Router with extractors (Path, Query, Json)
  • Quinn + h3 setup with TLS
  • Connection lifecycle and graceful shutdown
  • Error handling

Run it:

cargo run --example server

# Test:
curl --http3-only -k https://localhost:4433/
curl --http3-only -k https://localhost:4433/users/123

License 📝

MIT or Apache-2.0

Commit count: 0

cargo fmt