This is your reference for building production Rust HTTP APIs with Axum. It covers the essentials: typed extractors for request parsing, Tower middleware composition for timeouts and tracing, shared state management with Arc, structured error handling via IntoResponse, and graceful shutdown patterns. The testing section shows you how to test routers without spinning up actual sockets using tower::ServiceExt. If you're choosing between Rust web frameworks, this makes the case for Axum's strengths: excellent type safety at request boundaries and composable middleware. Watch out for the anti-patterns section on blocking the async runtime, it's an easy mistake that tanks performance.
- skills.sh installs
- 500
- GitHub stars
- 79
- last updated
- Aug 21, 2026
Install
$ npx -y skills add bobmatnyc/claude-mpm-skills --skill axum --agent claude-codeInstalls into .claude/skills of the current project.
Files
Axum (Rust) - Production Web APIs
Overview
Axum is a Rust web framework built on Hyper and Tower. Use it for type-safe request handling with composable middleware, structured errors, and excellent testability.
Quick Start
Minimal server
✅ Correct: typed handler + JSON response
use axum::{routing::get, Json, Router};
use serde::Serialize;
use std::net::SocketAddr;
#[derive(Serialize)]
struct Health {
status: &'static str,
}
async fn health() -> Json<Health> {
Json(Health { status: "ok" })
}
#[tokio::main]
async fn main() {
let app = Router::new().route("/health", get(health));
let addr: SocketAddr = "0.0.0.0:3000".parse().unwrap();
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
axum::serve(listener, app).await.unwrap();
}
❌ Wrong: block the async runtime
async fn handler() {
std::thread::sleep(std::time::Duration::from_secs(1)); // blocks executor
}
Core Concepts
Router + handlers
Handlers are async functions that return something implementing IntoResponse.
✅ Correct: route nesting
use axum::{routing::get, Router};
Sponsors
Details
- Repository
- github.com/bobmatnyc/claude-mpm-skills
- Categories
- Backend & APIs, Testing & QA, Debugging, Rust
- First seen
- Jun 3, 2026
More from bobmatnyc/claude-mpm-skills
All 158- Hono Core500
- Zustand496
- Asyncio494
- Mcp Protocol Builder491
- Typescript Core487
- Bug Fix482
- Supabase Backend Platform482
- Mypy478
- Threat Modeling474
- Wordpress Block Editor Fse474
- Celery470
- Web Performance Optimization469
- Local Llm Ops464
- Golang Testing Strategies458
- Wordpress Advanced Architecture455
- Golang Http Frameworks453
- Sveltekit452
- Digitalocean Management451
- Hono Rpc450
- Flask449
- Hono Middleware444
- Golang Cli Cobra Viper438
- Dependency Audit434
- Wordpress Plugin Fundamentals434
