Axum
Ergonomic, modular async web framework for Rust built on Tokio, Tower, and Hyper. Routes handlers are async functions that use extractors to declaratively parse request parts (JSON body, path params, headers, query strings). Middleware via Tower's Service trait — leverages the entire Tower ecosystem. The most popular Rust web framework for building APIs and agent tool servers.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
MIT licensed. Rust memory safety. TLS via rustls or native-tls. Tower middleware for rate limiting, auth. Tokio-rs maintained — high security bar.
⚡ Reliability
Best When
You're building a high-performance Rust API service or tool server where type safety, async performance, and the Tokio/Tower ecosystem are priorities.
Avoid When
You're new to Rust or need full-stack templating. For prototyping, Actix-web may have more examples; for learning Rust, Rocket has more beginner-friendly ergonomics.
Use Cases
- • Build high-performance agent HTTP API servers in Rust with type-safe routing and request extraction
- • Create Rust-based MCP (Model Context Protocol) servers with async HTTP/WebSocket endpoints
- • Implement agent tool endpoints with automatic JSON parsing via axum::extract::Json<T> and Serde deserialization
- • Build microservices for agent systems requiring maximum throughput with minimal memory footprint
- • Develop WebSocket-based agent coordination servers using axum's native WebSocket upgrade support
Not For
- • Full-stack web development with templating and ORM — use a framework like Rails/Django for full-stack; Axum is API-first
- • Developers new to Rust — Axum's extractor pattern and tower middleware require intermediate Rust knowledge
- • GraphQL servers without extra crates — use async-graphql with axum integration for GraphQL support
Interface
Authentication
Framework for building APIs — auth is implemented by the developer via middleware. Tower middleware for JWT/session auth available.
Pricing
MIT licensed. Zero cost.
Agent Metadata
Known Gotchas
- ⚠ Extractor rejection order matters — if extractors fail, Axum returns 400/422; implement IntoResponse for AppError enum to customize all error responses
- ⚠ State sharing: use axum::extract::State<Arc<AppState>> for shared state — not thread-local; state must be Clone + Send + Sync
- ⚠ Route layer vs router layer: router.layer() applies to ALL routes; router.route_layer() applies to matched routes only; wrong layering causes incorrect middleware behavior
- ⚠ Body extraction is exclusive — cannot extract Json<T> AND Form<T> from the same request; choose one or use Request<Body> for manual parsing
- ⚠ Path parameters: use axum::extract::Path<(String, u32)> for multiple path params or Path<HashMap<String, String>> for dynamic keys
- ⚠ WebSocket upgrade: use axum::extract::WebSocketUpgrade then .on_upgrade(|ws| async { ... }) — WebSocket handler runs as a separate async task
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Axum.
Scores are editorial opinions as of 2026-03-06.