๐Ÿฆ€

Axum

Axum is a Rust web framework built by the Tokio team, the same group behind Rust's dominant async runtime. It ranks around #26 among web frameworks at roughly 2.8% usage share. It's known for type-safe routing and "extractors" that pull typed data straight out of requests, extremely high raw performance, and tight integration with Tokio โ€” making it a popular pick for Rust developers building high-throughput APIs and microservices.

Quick facts
Type: Rust web framework
Made by: Tokio team
License: Free / open-source (MIT)
Language: Rust
Primary use case: High-performance, type-safe APIs and microservices in Rust
Jump to: ExampleGetting startedBest for

Example

Axum builds a router by mapping paths to async handler functions, with extractors like Path pulling typed values straight out of the URL.

use axum::{routing::get, Router, extract::Path};

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

async fn greet(Path(name): Path<String>) -> String {
    format!("Hello, {}!", name)
}

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

    let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}

Getting started

Create a new Rust binary project with Cargo, then add Axum and Tokio as dependencies.

# create a new Rust project
cargo new my_api
cd my_api

# add dependencies
cargo add axum tokio --features tokio/full

# run it
cargo run
Best for: Rust developers building performance-critical APIs and microservices who want strong compile-time type safety around routing and request data, backed directly by the Tokio async ecosystem.