Axum Framework

Develop Axum web applications with routing, extractors, state, and middleware.

Updated Jan 22, 2026
One-click install
npx skills add https://github.com/ngxtm/skill-rule --skill axum-framework
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Axum Framework
Source: https://github.com/ngxtm/skill-rule/tree/main/rules/rust/axum
Command: npx skills add https://github.com/ngxtm/skill-rule --skill axum-framework

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a structured and opinionated approach to building web applications in Rust using the Axum framework, simplifying routing, state management, and error handling.

Core Features & Use Cases

  • Ergonomic Routing: Define API endpoints with clear path and method matching.
  • State Management: Share application state safely across handlers.
  • Error Handling: Implement custom, type-safe error responses.
  • Middleware: Apply cross-cutting concerns like logging and authentication using Tower layers.
  • Use Case: Develop a RESTful API for a new microservice, ensuring consistent error responses and efficient request handling.

Quick Start

Use the Axum Framework skill to create a basic web server with a GET endpoint at the root path.

Frequently Asked Questions about Axum Framework

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up routing for a Rust web API using Axum?

Axum routing defines API endpoints through ergonomic path and method matching. You configure a Router to map specific HTTP methods and paths directly to handler functions, simplifying endpoint organization for Rust web services.

How does state management work in Axum handlers?

State management in Axum uses the `State<T>` extractor to share application state safely across handlers. You pass state into your router, and Axum injects it directly into handler functions for thread-safe access.

What is the best way to handle custom errors in a Rust Axum backend?

Custom error handling in Axum is implemented by converting error types into HTTP responses using the `IntoResponse` trait. This approach ensures type-safe, consistent error responses across your Rust web service.

Can I use Tower middleware layers with Axum for logging and authentication?

Yes, Axum integrates seamlessly with Tower middleware layers. You apply cross-cutting concerns like logging and authentication by adding Tower layers to your router, ensuring robust request processing in Rust backend services.

How do I extract request data in Axum web framework handlers?

Axum uses extractors to access request data within handlers. Extractors parse incoming HTTP request components like JSON bodies, path parameters, and headers, passing the extracted data directly as typed handler arguments.

Does Axum require Tokio for building reliable Rust web services?

Axum is designed as an asynchronous Rust web framework that operates within the Tokio ecosystem. Utilizing Tokio enables Axum to facilitate the creation of fast, non-blocking, and reliable backend services.