Cogs and Levers A blog full of technical stuff

axum

Rust web frameworks used to feel heavy. axum feels modern.

Built on Tokio and Hyper, it embraces async and type-driven routing.

What Problem Does axum Solve?

Building HTTP APIs with:

  • Extractors
  • Strong typing
  • Async handlers
  • Minimal boilerplate

Without sacrificing performance.

Minimal Example

Cargo.toml

[dependencies]
axum = "0.6"
tokio = { version = "1", features = ["full"] }

main.rs

use axum::{routing::get, Router};
use std::net::SocketAddr;

async fn hello() -> &'static str {
    "Hello, axum"
}

#[tokio::main]
async fn main() {
    let app = Router::new().route("/", get(hello));

    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
    axum::Server::bind(&addr)
        .serve(app.into_make_service())
        .await
        .unwrap();
}

What’s Actually Happening?

Axum uses:

  • Traits for handler signatures
  • Extractors for request parsing
  • Tower middleware stack underneath

It’s deeply type-driven.

Should You Use It?

If you’re building modern Rust APIs:

Yes.

It’s one of the cleanest web frameworks in the ecosystem.