# Axum — Ergonomic Modular Web Framework for Rust > Axum is a web application framework built on Tokio, Tower, and Hyper. Focuses on ergonomics and modularity with a macro-free routing API, seamless Tower middleware integration, and type-safe extractors. The official Tokio team web framework. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use ```toml # Cargo.toml [dependencies] axum = "0.8" tokio = { version = "1", features = ["full"] } serde = { version = "1", features = ["derive"] } serde_json = "1" ``` ```rust use axum::{routing::{get, post}, Json, Router}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] struct Asset { repo: String, stars: u32, } async fn list_assets() -> Json> { Json(vec![ Asset { repo: "react".into(), stars: 230000 }, ]) } async fn create_asset(Json(payload): Json) -> Json { Json(payload) } #[tokio::main] async fn main() { let app = Router::new() .route("/api/assets", get(list_assets).post(create_asset)); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); axum::serve(listener, app).await.unwrap(); } ``` ## Intro Axum is a web application framework built by the Tokio team. It focuses on ergonomics and modularity with no macros — just functions and extractors. Built on top of Tokio, Tower, and Hyper, Axum integrates seamlessly with the entire Tower middleware ecosystem. - **Repo**: https://github.com/tokio-rs/axum - **Stars**: 25K+ - **Language**: Rust - **License**: MIT ## What Axum Does - **Macro-free routing** — plain function handlers - **Extractors** — type-safe request data extraction (Json, Path, Query, State) - **Tower middleware** — use any Tower middleware (timeout, rate-limit, tracing) - **WebSocket** — built-in upgrade support - **State sharing** — via Extension or State extractor - **Nested routers** — composable sub-routers - **Error handling** — typed error responses ## Comparison | Framework | Macro | Tower | Tokio-native | |---|---|---|---| | Axum | None | Full | Yes | | Rocket | Heavy | No | Own runtime | | Actix Web | Moderate | No | Own runtime | ## FAQ **Q: Why choose Axum?** A: It's officially from Tokio and integrates seamlessly with the whole Tokio ecosystem (Hyper, Tower, Tonic). If you already use Tokio, Axum is the most natural choice. ## Sources - Docs: https://docs.rs/axum - GitHub: https://github.com/tokio-rs/axum - License: MIT --- Source: https://tokrepo.com/en/workflows/axum-ergonomic-modular-web-framework-rust-412ff341 Author: Script Depot