Axum is a Rust HTTP routing library for developers who want to choose how their backend fits together. Our October source run passed all 697 tests, after a successful install and build. Use it if you already want Tokio and can own your database, authentication and response conventions; skip it if you want a framework to supply the application structure, the work that thoughtbot's Rails developers had to assemble themselves.
What people use axum for
Developers have used axum for HTML applications, reverse proxies and public APIs, with integration work that differs sharply between those jobs.
- Mike Burns, Dimiter Petrov and George Kosmopoulos at thoughtbot built a traditional HTML application during a company hackathon using SQLx, Askama templates and shared application state. They found a structure that allowed quick iteration, but ran out of time before their browser integration tests were satisfactory in their axum 0.6 account.
- GitHub user nicolaspernoud used axum in the Atrium reverse proxy. An upgrade from 0.5 to 0.6 reduced reported throughput, and replacing nested routers with explicitly prefixed, merged routes restored the original performance in issue #1624.
- GitHub user simon-amadeus built a public REST API and customized JSON and query-input rejection responses to avoid exposing internal details. The developer praised axum's examples while describing the extra error-handling work in issue #1116.
- Rust forum user finlaydotb tried handlers implemented as struct methods, reached working code after ownership and cloning changes, and then identified the suggested
Stateapproach as the next thing to investigate in the handler-method discussion.
The thoughtbot account is especially useful if you're coming from a framework that chooses a directory layout and database conventions. Their handlers could extract database state without passing the whole application around. They also had to connect logging, configuration, pooling and command runners themselves. Read that as a decision about who maintains the glue: you can choose each component, but your application team inherits the choices.
What happened when we ran it
Our October 24, 2026 sandbox run installed axum's dependencies in 28 seconds, built the repository in 31 seconds and passed 697 tests in 116 seconds.
We ran commit 86aa615 in our sandbox. Our measurement setup had 3 CPUs, 12 GB of configured RAM and image label lab-rust:1. Installation succeeded first, then the build succeeded, and cargo test finished with no failed cases. The later deployment attempt had a different outcome: on November 29, the safety step failed because no supported Compose filename existed. The harness called this an "unsafe repo" because its rule required a Compose file. That wording describes the harness's deployment rule, not a security finding about axum.
| Recorded check | Result | Meaning for your decision |
|---|---|---|
| Dependency installation | Succeeded in 28 seconds, 62 dependencies recorded | The measured source setup completed |
| Build | Succeeded in 31 seconds | That checkout built in the configured sandbox |
| Tests | Succeeded in 116 seconds, 697 passed and 0 failed | The recorded Cargo suite completed successfully |
| Repository scan | 500 files, about 47,984 source lines, 2 MB checked out | Checkout size excludes any claim about deployment footprint |
| Project signals | 2 CI workflow files, no Dockerfile, no tests directory | A directory scan and the executed suite answer different questions |
| November deployment safety step | FAILED: no compose.yaml, compose.yml, docker-compose.yaml or docker-compose.yml |
The Compose-only deployment path stopped at its prerequisite |
| November teardown | OK | Cleanup was recorded |
The first five rows are our October source-run measurements. The November failure is the recorded safety check, followed by successful teardown. A missing top-level tests directory plainly didn't prevent the recorded Cargo suite from running.
Axum is a library you add to an application. Its README example creates a router, binds a Tokio TCP listener and calls axum::serve. Requiring a ready-made Compose application before that library can enter a deployment harness puts an application-packaging requirement ahead of the thing being reviewed. Keep the failed attempt on the page, but don't mistake it for an application crash.
Where people get stuck: rejected input still needs an API contract
Extractor rejection responses can require customization when your public API promises a consistent JSON error format, as issue #1116 describes.
An extractor is the part that turns an incoming request into a handler argument, such as parsed JSON, query parameters or a path identifier. In that issue, simon-amadeus discovered a rejection containing an internal Rust module path after sending a request with curl. Existing integration tests had missed the failure-response behavior. The practical lesson is specific: a successful request tells you little about what a malformed one reveals to the caller.
| Problem people reported | Response or workaround in the discussion | Status boundary |
|---|---|---|
| Plain-text extractor errors and unwanted internal details, #1116 | Customize Json and Query rejections; a maintainer reports implementing a derive-based improvement |
The broader discussion is open in the captured thread |
Multiple Handler::layer calls slowed historical compilation, #200 |
Use tower::ServiceBuilder for several middleware layers |
Maintainer-recommended workaround, not a current compiler benchmark |
Struct-method handlers led to ownership and Clone errors |
A forum respondent demonstrated free functions using State<Arc<ServerLogic>> |
An alternative handler organization, not an efficiency measurement |
Routing separately by Content-Type, #1654 |
Use an extractor or dispatch within a handler; a maintainer also suggested axum-extra handler composition |
The closed thread describes application-level approaches |
The compiler and layering workarounds come from issue #200, the state example from finlaydotb's thread, and the content-routing discussion from issue #1654. Don't transplant their old APIs into a new project. Use the problem descriptions to decide which behavior belongs in your own service template.
For errors, that means choosing a response schema before you expose the endpoint. Keep public error codes separate from internal diagnostic text, and include rejected bodies and invalid query parameters in your application's checks. This is our recommended application policy, prompted by the failure simon-amadeus actually found.
Old routing reports show where volume hurts
In the historical axum 0.6.1 reverse-proxy report, nicolaspernoud measured approximately 24,500 requests per second before the upgrade and 16,500 afterward in issue #1624.
Maintainer jplatte asked whether the application nested routers and suggested prefixing the routes individually, then merging them. The reporter tried that and said the original performance returned, adding the important detail that the merged routes weren't themselves reached by the benchmark. That is a useful diagnostic history, not a reason to flatten every current router. It tells you to preserve the real route tree when you investigate an upgrade regression.
A separate incident shows why a request log can miss the request you need. Power2All reported torrust-axum panics on 0.6.16 and stability after downgrading to 0.6.12 in issue #1955, about CONNECT requests. Maintainer davidpdrsn realized that middleware running after routing complicated logging a panic that occurred during routing. The thread includes work on a logging example and records the reporter's downgrade workaround.
If you're building a proxy, make rejected and unusual HTTP methods part of the traffic you inspect, and decide where request capture happens relative to route selection. The transferable finding is the observability gap: logging placed beyond the failing stage cannot explain what reached that stage. The release-fix and current-version boundaries for both incidents are collected below.
Security: header values need a connection-trust policy
Host and Scheme values can come from client-spoofable headers, according to issue #2998.
The discussion considered a Spoofable wrapper to make the risk visible where a handler receives the value. That is useful for code review. It doesn't itself decide which proxy may supply a forwarded host or scheme. Participant sclu1034 instead proposed central middleware that strips headers according to whether the connection can be trusted, so every extractor and manual header read follows the same rule.
For a service behind a gateway, our recommended policy is to make that decision once. Identify the immediate peer from connection information, accept forwarded values only from the gateways you trust, and discard client-supplied forwarding headers on other connections. Have the trusted gateway replace those headers rather than simply preserving arbitrary incoming values. For externally visible links or security decisions, apply your own allowed-host policy too. This is a deployment design recommendation based on the threat described in #2998, not a claim that axum ships this policy configured for you.
Authentication examples deserve the same scrutiny. In Eze Sunday's LogRocket JWT tutorial, the demonstrated retrieve_user_by_email constructs and returns a hardcoded user. Treat that function as a placeholder to replace before you use the surrounding login flow with real accounts.
Tower errors and shared state remain your choices
Fallible Tower middleware needs explicit conversion from a service error into an HTTP response, as axum's error-handling documentation explains.
Tower is the shared service interface that axum uses for middleware, the code around a handler that handles tasks such as tracing or timeouts. Returning an application error that implements IntoResponse is one path. Adding a service that can fail is another: the docs demonstrate HandleErrorLayer around a timeout so the service's error becomes a response. Those are different responsibilities even though both get called "error handling."
State has a similarly explicit cost. The official docs say state is cloned for each request. Arc is Rust's shared-ownership pointer, and wrapping state in it makes those clones cheap. If your fields are already cheap to clone, a plain cloneable state struct can be appropriate. with_state doesn't choose that representation for you.
This is why I'd choose axum for a team that already understands its service boundaries. You can put the same error and state policies into every application. If you're still deciding what those policies should be, budget that design work alongside the first endpoint.
OpenAPI can serve as an API-change review
GitHub participant tasn describes using a generated OpenAPI specification in CI to catch accidental API changes and send intentional ones to designated code owners in issue #50.
OpenAPI describes an HTTP API in a form tooling can read. The useful part of that account goes beyond hosting a Swagger page: a changed route or response becomes something a reviewer can inspect. The thread explores generation designs, and a maintainer explicitly discusses developing the work in an external crate. Its closed label isn't a promise that every axum router automatically emits a specification.
If this is a requirement for your service, choose the integration when you choose the framework. Our suggested workflow is to generate the specification, compare it in CI, and require an owner to approve deliberate changes to the public contract. Include your custom rejection format in that review, because callers depend on failure responses as well as successful ones.
Axum vs Actix Web, Warp, Rocket and Rails
Axum vs Actix Web is a choice about application and middleware interfaces before it is a speed contest: axum uses Tower services, while Actix Web documents its own routing and middleware facilities.
| Alternative | What the comparison rests on | Choose it when |
|---|---|---|
| Actix Web | Its README lists Tokio compatibility, routing with optional macros and middleware | Your team prefers Actix's application interface; Tokio alone doesn't distinguish the two |
| Warp | Its README makes composable Filter values the fundamental building block |
You like filter composition or already maintain a Warp application |
| Rocket | A participant in axum's OpenAPI discussion considered Rocket specifically for an OpenAPI generator | That generator fits your API documentation workflow better |
| Rails | thoughtbot's Rails developers had to supply structure and infrastructure themselves in axum | Framework conventions matter more to you than choosing Rust components individually |
Those are criteria you can inspect: Actix Web's feature list, Warp's filter model, the Rocket comment in #50 and thoughtbot's Rails comparison. Encore's axum vs Warp article illustrates the function-handler versus filter distinction, but also promotes Encore's own infrastructure service. Read its product recommendation with that interest in mind.
For axum vs FastAPI or Django, start with whether you're choosing a Rust backend at all. Our recommendation of axum is for developers who want its documented Tokio and Tower composition; it doesn't rank Python frameworks on development speed. For axum vs Tokio or hyper, the relationship is different: the axum docs explicitly target Tokio and hyper. They are the runtime and HTTP components beneath this framework choice.
What the other reviews get wrong
Shuttle's axum guide and Maqsoodarsalan's Medium introduction overstate details that change how you write the application.
| Page and claim | Correction you can act on |
|---|---|
| Maqsoodarsalan's Medium guide says every Tower middleware works out of the box | Axum's error-handling docs require error conversion for fallible middleware, including timeouts |
Shuttle's guide says with_state automatically wraps state in Arc |
The official docs show the application creating Arc and say state is cloned for every request |
Shuttle's guide claims an axum 0.8 update but shows /users/:id |
The migration guidance uses /users/{id} and says the old parameter syntax panics in 0.8 |
| Shuttle describes axum as having its own middleware system built on Tower | The official docs explicitly say axum uses tower::Service instead of its own middleware system |
| LogRocket describes retrieving a user by the submitted email | The demonstrated retrieval function always constructs and returns its hardcoded user |
The claims appear in the Medium introduction, Shuttle's guide and LogRocket's authentication walkthrough. The corrections come from the official state and middleware documentation, the official error model, the migration explanation, and the retrieval function itself.
Version discipline matters here. The current repository README warns that main contains breaking work toward 0.9 and points released users to the 0.8.x branch. The axum-v0.8.9 release notes set the minimum Rust version to 1.80. Match documentation to the version in your application rather than collecting snippets from different generations.
Questions people ask
Axum is the Rust HTTP routing and request-handling library in tokio-rs/axum, as its official documentation states.
What is axum, and is this review about the Rust framework or the Ethiopian city and empire?
This axum review covers the Rust library. Queries such as "axum meaning," "axum ethiopia" and "axum empire" can refer to a different entity: the city entry identifies Axum in Ethiopia. For software searches, "axum rust framework" narrows the name to the HTTP library.
Should I choose axum, Actix Web or Rocket for a Rust backend?
Choose axum when you want its Tower service interface. Actix Web also supports Tokio, so "Tokio integration" alone doesn't settle axum vs Actix. If OpenAPI generation decides the choice, #50 records a developer considering Rocket for that reason.
How does axum compare with FastAPI or Django?
Axum's documented design centers on Rust handlers, extractors and Tower services. For an axum vs FastAPI or Django decision, choose the language and required application conventions first. The hands-on comparison of assembly work here is thoughtbot's Rails-to-axum account, not a measured Python framework comparison.
How is axum different from Tokio and hyper?
Axum routes requests and extracts handler arguments; its docs say it is designed to work with Tokio and hyper. Tokio supplies the runtime and hyper the HTTP layer. Axum vs Tokio therefore compares different parts of an application stack rather than interchangeable web frameworks.
Should I use axum or Warp?
Axum registers async handlers and uses extractors. Warp's fundamental building block is the composable filter. Prefer the interface your team wants to maintain, including the existing routes you'd have to rewrite.
Where are the official axum documentation and learning resources?
The official axum docs are the crate documentation on docs.rs. The repository README links examples, Discord and GitHub discussions. Start with the documentation for your crate version, especially when following an older tutorial.
How do I install axum, and which Rust version does it require?
Add axum and Tokio as dependencies of your Rust application, following the official dependency guidance. The 0.8.9 release notes raise the minimum Rust version to 1.80. The current README directs you to the selected crate's rust-version field for its requirement.
How do I build an axum API with SQLx and SQLite?
A database connection pool can be passed through axum's shared state. The concrete SQLx story here uses PostgreSQL: thoughtbot ran migrations separately before compiling after encountering compile-time query dependencies. Use that dependency-order lesson without presenting their code as a SQLite recipe.
How do I add database access, cookies and deployment to an axum backend?
Axum's documented shared state can hold database pools or clients for other services. Those application components still need to be selected and connected: thoughtbot describes doing that infrastructure work. Choose cookie and deployment integrations against your application's version and requirements.
How should I handle application errors in axum?
Return a type that converts into an HTTP response for handler errors; use explicit adaptation for fallible services and middleware. The official timeout example uses HandleErrorLayer. Don't treat a service error escaping to hyper as a useful API response: the docs say it can terminate the connection without sending one.
How do I return consistent JSON errors for invalid Json and Query input?
Customize extractor rejection conversion rather than relying on the default text response. In #1116, simon-amadeus describes doing this for both input types, and a maintainer reports implementing a derive-based customization improvement. Make the rejected request's body part of the contract you check.
Can axum generate OpenAPI or Swagger documentation automatically?
The OpenAPI discussion explores generation and external-crate approaches; it doesn't turn an ordinary router into an automatic documentation promise. Evaluate a generator integration explicitly. Tasn's use of the generated specification in CI is a more useful adoption requirement than merely having a Swagger page.
What we have not tested yet
Our successful source run covers commit 86aa615, not a live workload, a comparative benchmark or the current default branch. We have not tested HTTP throughput, tail latency, memory consumption, database or cookie integrations, TLS, graceful shutdown, authentication, trusted-proxy enforcement, OpenAPI generation, SQLite, or a production deployment. The image label lab-rust:1 is a configuration label; actual runtime and operating-system versions require the raw toolchain logs.
The November run header describes deployment with Compose and loopback-bound ports, but its safety step records failure before a Compose deployment. We cannot confirm a running application from that contradictory header. There are no task answers or screenshots to evaluate. The video entries contain no transcripts, and the Bilibili search listing identifies topics rather than demonstrating outcomes, so neither supports an additional hands-on finding.
The 0.6 routing reports and early boxed-route discussion are historical. Their captured threads do not identify a released fix for every behavior discussed, and issue closure alone cannot establish current-version behavior. The reverse-proxy throughput belongs to nicolaspernoud's setup, not our lab or a general axum vs Actix Web ranking. Our next useful application exercise would combine the intended route tree, malformed requests, timeout responses and your actual gateway trust rules.


