mir-backend-rust-axumlisted
Install: claude install-skill anantbhandarkar/make-it-right
# /mir-backend-rust-axum · Make It Right (Axum)
Bottom tier of the chain: `mir-backend` (generic gates) → `mir-backend-rust` (Tokio runtime model) → **this** (Axum/Tower library mechanics). Run the gates first; load the Rust runtime tier for blocking/cancellation/Arc concerns; reach for *this* at Gate 5 (design mechanics), Gate 6 (implementation), and Gate 7 review. **Runtime-level concerns (blocking the Tokio runtime, guard-across-await, cancellation safety, bounded channels, timeouts) live in `mir-backend-rust` — not here.**
**Stack assumed:** Axum (current stable, 0.7+) · Tower middleware · async Rust on Tokio. Notes apply to `axum` with `tokio` and `tower`/`tower-http`.
## The Axum footguns AI walks into most
### 1. Extractor order — body-consuming extractors MUST be last
This is the #1 Axum compile/runtime trap. HTTP request bodies are streams: **reading the body consumes it**. Axum extractors that consume the body (`Json<T>`, `String`, `Bytes`, `Form<T>`, `Multipart`) must be the **last parameter** in the handler signature. Only **one** body-consuming extractor per handler is allowed — the request has one body.
Extractors that do NOT consume the body (they read headers, URI, path, query, or app state) can appear in any position: `Path<T>`, `Query<T>`, `State<T>`, `Extension<T>`, `TypedHeader<T>`, `ConnectInfo<T>`.
```rust
// WRONG — Json is not last; compilation may succeed but the extractor
// that follows Json will see an empty/already-consumed body
async fn cr