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-code

Installs 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
1openzeppelin avatarupgrade-solidity-contractsopenzeppelin/openzeppelin-skillsUpgrade Solidity smart contracts using OpenZeppelin proxy patterns. Use when users need to: (1) make contracts upgradeable with UUPS, Transparent, or Beacon pro500skills.sh installs
2davila7 avatarreact-devdavila7/claude-code-templatesThis skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components a498skills.sh installs
3freestylefly avatarcanghe-post-to-wechatfreestylefly/canghe-skillsPosts content to WeChat Official Account (微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text p498skills.sh installs
4martinholovsky avatarrabbitmq-expertmartinholovsky/claude-skills-generatorExpert RabbitMQ administrator and developer specializing in message broker architecture, exchange patterns, clustering, high availability, and production monito498skills.sh installs
5streamlit avatardebugging-streamlitstreamlit/streamlitDebug Streamlit frontend and backend changes using make debug with hot-reload. Use when testing code changes, investigating bugs, checking UI behavior, or needi498skills.sh installs
6openclaudia avatarsemrush-researchopenclaudia/openclaudia-skillsSEO and competitive intelligence via the SemRush API. Use when asked to research competitors, analyze domains, find keyword opportunities, check backlinks, or e497skills.sh installs