Introduction To Axum - Axum - Complete Documentation by ntxm.org

Client-Server Model

Understand the client-server model, how clients and servers interact, and why this architecture is the foundation of all web applications.

HTTP Request Structure

Learn the four essential parts of every HTTP request - method, path, headers, and body - and how they work together to communicate with a web server.

HTTP Response Structure

Learn how an HTTP response is built from a status line, headers, and body, and see how Axum handlers generate these responses with practical code examples.

HTTP Methods GET POST PUT PATCH DELETE

Learn what the five core HTTP methods mean, when to use each one, and how they map to Axum routing for building backend services

URLs, Paths, and Query Strings

Learn how URLs are structured, what path segments and query strings do, and how to read them from a browser or HTTP client.

Headers and Content-Type

Learn what HTTP headers are, how Content-Type and MIME types work, and how to read and set them in Axum

Status Code Ranges 2xx 3xx 4xx 5xx

Learn what HTTP status code ranges mean, the most common codes in each range, and how to use them correctly in web applications.

HTTP Statelessness - What It Means and Why Servers Forget

Learn what HTTP statelessness means, why the protocol works this way, how servers handle requests without remembering previous ones, and how real applications simulate memory using tokens and server-side storage.

What a Web Framework Provides

Understand the core responsibilities of a web framework like Axum and how it simplifies building web servers.

Why Rust for Backend Services

Learn the core reasons Rust is a strong choice for building backend services, focusing on memory safety, performance, and concurrency without a garbage collector.

Blocking vs Non-Blocking I/O

Understand the difference between blocking and non-blocking I/O, why it matters for backend services, and how Rust's async ecosystem solves the scalability problem without threads blocking each other.

What an Async Runtime Is

A beginner-friendly explanation of async runtimes in Rust, why they are needed, and how they make non-blocking I/O practical.

Tokio Runtime Role

Understand how the Tokio async runtime powers Axum, why Axum depends on it, how to set it up with the tokio main macro, and common mistakes beginners make when running async handlers.

Hyper as HTTP Engine

Learn how Hyper powers Axum as its underlying HTTP engine, handling protocol parsing, connection management, and more.

Tower Service and Layer Idea

Understand the Tower Service and Layer abstractions that power Axum middleware, with beginner-friendly explanations and practical examples.

Axum Version Line and Stability Notes

Understand how Axum versioning works, what 0.x means, the key changes between 0.7 and 0.8, and how to approach upgrades safely.

Axum as HTTP Routing Library

How the Router type matches incoming HTTP requests to the correct handler functions using a clean macro-free API

Axum as request handling library

Learn how Axum processes incoming HTTP requests through handlers, extractors, responses, and its predictable error model

Ergonomic Modular Design in Axum

Understand how Axum's ergonomic API and modular composition work together to make building web services in Rust clear and maintainable

Macro-free Routing API in Axum

Learn how Axum lets you define HTTP routes with plain Rust functions and method chaining instead of attribute macros, why this design matters, and how to use it in practice.

Tokio Team Maintenance

Learn what it means that Axum is maintained by the Tokio team, why that matters for stability and long-term support, and how you can participate in the project's development.

Hyper compatibility

Understand how Axum works with the Hyper HTTP library, why the two are tightly connected, and how you can use Hyper types and services inside an Axum application.

Tower Service Integration in Axum

How Axum uses Tower's Service trait for composable request handling, shared middleware, and modular design.

Tonic middleware sharing

Learn how Axum and Tonic share middleware through Tower's Service abstraction, why that matters, and how to write reusable middleware that works for both HTTP and gRPC.

Ordinary Rust Function Handlers in Axum

Learn what handlers are in Axum, how to define them as plain async Rust functions, and what makes them valid handlers with many beginner-friendly examples.

Type-driven extractors

Learn what type-driven extractors are in Axum, why they make request handling simple and safe, and how to use them in your Rust handlers

Compose Small Well-Typed Pieces in Axum

Learn how Axum encourages building web applications from small, type-safe components like handlers, extractors, and middleware, and how to combine them effectively.

Type-safe routing in Axum

Understand how Axum uses Rust's type system to catch routing mistakes at compile time, with many examples of typed path parameters, query parameters, and state handling.

Compile-time extractor checks

Learn how Axum validates extractor usage in handler signatures when your program compiles and how to read and fix the resulting errors

Tower reusable middleware

Learn how Axum uses Tower for reusable middleware - apply, order, and write middleware that works across the Rust ecosystem.

The tower-http Layer Ecosystem in Axum

Understand how Axum uses tower-http layers for tracing, compression, CORS, and timeouts, with beginner-friendly examples and practical guidance.

Minimal Boilerplate

Learn how Axum reduces repetitive setup code with a macro-free API, type-safe extractors, and automatic response conversion, allowing you to build a web server with very few lines.

Explicit Dependency Surface in Axum

Learn how Axum makes every dependency visible in function signatures and router construction, so you always know what a handler needs to run

Predictable Error Model in Axum

Understand how Axum turns handler errors into HTTP responses and why that model is predictable.

Async I/O via Tokio in Axum

Why Axum's async I/O model with Tokio enables high-concurrency web servers and how to write non-blocking handlers correctly.

Fit for Tokio-based Teams

Learn why Axum is a natural fit for teams that already use Tokio as their async runtime, including shared runtime benefits, ecosystem compatibility, and real-world scenarios.

Axum Fit for REST JSON APIs

Learn why Axum is a natural choice for building REST APIs that communicate with JSON, with beginner-friendly examples and practical walkthroughs.

Axum for Microservices Backends

Learn why Axum is an excellent choice for building microservices, with practical examples of structuring services, health checks, error handling, and shared middleware.

Fit for SPA backends

Learn why Axum is a strong choice for building the backend of a single-page application, including static file serving, JSON APIs, client-side routing fallback, and CORS setup.

Fit for mobile app backends

Why Axum is well suited for building backends that serve mobile applications, with examples of JSON APIs, authentication, and efficient request handling.

Fit for Desktop App Backends

Learn why Axum is a strong choice for building backends that serve desktop applications, with examples for local servers and remote APIs.

Fit for BFF layers

Learn how Axum fits the Backend for Frontend pattern with aggregation, transformation, and tailored APIs for different client types

Fit for WebSocket Backends

Why Axum is a strong choice for building WebSocket backends, with a complete beginner-friendly echo server example and detailed explanation of the upgrade process, message handling, and common pitfalls.

Axum for Real-Time Backends

Learn why Axum is well-suited for building real-time backend services with streaming responses, Server-Sent Events, and concurrent connection handling in Rust.

Actix-web in the Rust web framework landscape

Understand where Actix-web fits among Rust backend frameworks, how its architecture differs from Axum, and what kind of projects benefit from choosing it.

Rocket in the landscape

Understand where the Rocket web framework fits among Rust backend tools, how its attribute-macro design differs from Axum, and when its style works well.

Warp in the landscape

A beginner-friendly guide to understanding the Warp web framework for Rust, how it works with filters, and where it fits alongside Axum and other Rust web frameworks.

Hyper in the landscape

Learn what Hyper is, how it fits into the Rust HTTP ecosystem, why Axum is built on top of it, and what Hyper means for Axum developers.

Actix-web vs Axum Tower Service Model

A beginner-friendly comparison of how Actix-web and Axum structure their request handling with the service model they now share, including code examples and common mistakes

Actix-web vs Axum layer composition

Compare how middleware layers are composed in Axum and Actix-web, with practical examples for absolute beginners.

Actix-web actor model contrast

Understand how Actix-web's historical actor model compares to Axum's service-based approach, what Actix-web 4.x actually uses today, and where each design fits best.

Actix-web vs Axum Extractor Style

Compares how Actix-web and Axum extract data from HTTP requests and pass it to handler functions, including path parameters, query strings, JSON bodies, and custom extractors.

Actix-web vs Axum learning curve

A beginner-friendly comparison of what makes Actix-web and Axum easy or difficult to learn, with examples and guidance on choosing based on your learning style.

Actix-web vs Axum Macro Usage

Compare how Actix-web and Axum handle routing and handler definitions with and without macros, and what that means for beginners choosing between the two Rust web frameworks.

Actix-web vs Axum middleware compatibility

Understand how middleware works in Axum and Actix-web, why they use different systems, and what that means for reusing code between the two frameworks.

Actix-web vs Axum ecosystem maturity

Learn how the library and tooling ecosystems around Actix-web and Axum differ in age, compatibility, available crates, and what that means for a beginner building a Rust web service.

Rocket vs Axum Attribute Macros

Learn how Rocket uses attribute macros for routing and handlers while Axum avoids them in favor of a macro-free API, with side-by-side examples and beginner explanations.

Rocket vs Axum Macro-Free Routes

Compare how Rocket uses attribute macros for route definitions while Axum registers routes with plain function calls and no macros

Rocket vs Axum handler signatures

Compare how handler functions are written in Axum and Rocket, focusing on function parameters, extractors, return types, and the underlying design differences.

Warp vs Axum filter combinators

Compare how Warp uses filter combinators for routing and how Axum uses Router and handlers to achieve similar results, with beginner-friendly examples.

Warp vs Axum Router and Handlers

Compare how routing and handler functions work in Axum and Warp, with examples of path parameters, methods, and request extraction.

Hyper as HTTP Library vs Axum

Compare the low-level Hyper HTTP library with the Axum web framework to understand what each provides and when to use one directly versus the other

Axum Built on Hyper

Understand how Axum uses Hyper as its underlying HTTP engine, what each layer does, and why this design gives you a fast, reliable, and ergonomic web framework.

axum serve Explained

Learn how axum serve starts your HTTP server, what it does behind the scenes, and how it compares to using Hyper directly