Building Fast Websites with Rust and Axum
Rust is known for systems programming, but it's also an excellent choice for web development. The Axum framework provides a type-safe, async-first approach that competes with Go and Node.js in performance while offering memory safety guarantees.
Why Axum?
Axum builds on top of the Tower ecosystem, giving you composable middleware and a clean routing API. Unlike frameworks that rely on macros or dynamic dispatch, Axum leverages Rust's type system to catch errors at compile time.
Key benefits:
- Zero-cost abstractions — no runtime overhead for features you don't use
- Shared state via
Arc— safe concurrent access across handlers - Extractor pattern — type-safe request parsing without manual deserialization
async fn hello(State(state): State<Arc<AppState>>) -> impl IntoResponse {
Html("<h1>Hello from Rust!</h1>")
}
Performance
In benchmarks, Axum consistently performs within 5% of hand-rolled hyper servers, serving 100k+ requests per second on modest hardware. For most applications, the bottleneck will be your database, not the web framework.
Deployment
Compile to a single static binary, copy it to your server, and run. No runtime dependencies, no interpreters, no VM. Just a 5MB binary that starts in milliseconds.
This site itself is built with Axum, Tera templates, and a few hundred lines of Rust. That's it.