Skip to main content
Axum is an HTTP routing and request-handling library that focuses on ergonomics and modularity. Built by the Tokio team, it provides a macro-free API for building web services with Rust.

Why Axum?

Axum stands out from other Rust web frameworks by leveraging the Tower ecosystem, giving you access to a rich set of middleware and utilities out of the box.

Ergonomic routing

Route requests to handlers with a clean, macro-free API that feels natural and intuitive.

Powerful extractors

Declaratively parse requests using type-safe extractors that handle validation automatically.

Tower ecosystem

Take full advantage of Tower and tower-http middleware for timeouts, tracing, compression, and more.

Type-safe responses

Generate responses with minimal boilerplate while maintaining compile-time guarantees.

Key features

Macro-free API

Unlike some Rust web frameworks, Axum doesn’t rely on procedural macros for routing. This means faster compile times and clearer error messages.
let app = Router::new()
    .route("/", get(root))
    .route("/users", post(create_user));

Built on industry standards

Axum is built on top of battle-tested libraries:
  • Tokio - Async runtime for handling concurrent connections
  • Hyper - Fast HTTP implementation
  • Tower - Modular service abstraction for middleware
Axum uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

Simple error handling

Axum provides a predictable error handling model. Handlers can return Result types, and you have full control over error responses.
async fn handler() -> Result<Json<User>, StatusCode> {
    let user = fetch_user().await
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
    Ok(Json(user))
}

Performance

Axum is a relatively thin layer on top of Hyper and adds very little overhead. This means Axum’s performance is comparable to Hyper itself, making it one of the fastest web frameworks available in any language.
Axum achieves excellent performance while maintaining ergonomics - you don’t have to choose between speed and developer experience.

Tower middleware

What sets Axum apart is its integration with the Tower ecosystem. Instead of building its own middleware system, Axum uses tower::Service, which means:
  • Share middleware with applications using Hyper or Tonic
  • Access to timeouts, tracing, compression, authorization, and more for free
  • Compose services in powerful ways using Tower’s abstractions
use tower_http::{compression::CompressionLayer, trace::TraceLayer};

let app = Router::new()
    .route("/", get(handler))
    .layer(CompressionLayer::new())
    .layer(TraceLayer::new_for_http());

Minimum supported Rust version

Axum’s MSRV is 1.80.

Next steps

Installation

Set up Axum in your Rust project

Quickstart

Build your first HTTP server in minutes

Examples

Explore real-world examples

API Documentation

Browse the complete API reference