rc-axumlisted
Install: claude install-skill rodolfochicone/rc-project
# Axum 0.8+ (Rust web API)
Opinionated guide for production Axum services (Tokio + Tower + Hyper). Target crate line: **axum 0.8.x** (docs verified against axum v0.8.4+). Pair with `rc-sqlx` for Postgres and `rc-sveltekit` when the front is SvelteKit.
## Core workflow
1. **Map boundaries** — routes vs domain vs infra; keep handlers thin.
2. **State** — one `AppState: Clone` (pool, config, clients); inject with `.with_state(...)`. Prefer `State<T>` over request-global `Extension` for app state.
3. **Extractors** — `Path`, `Query`, `Json`, `State`, `TypedHeader` as needed; fail early with typed errors.
4. **Middleware** — Tower `ServiceBuilder` order: errors/timeouts → tracing → CORS → auth `route_layer` where needed.
5. **Security** — bind loopback behind reverse proxy in VPS; CORS explicit origins; no secrets in logs. Read `references/security.md`.
6. **Test** — `tower::ServiceExt::oneshot` for HTTP; dedicated WS tests. Read `references/testing.md`.
7. **Lint** — `cargo fmt`, `clippy -D warnings`, release build. Read `references/lint-tooling.md`.
## Reference guide
| Topic | File | Load when |
| ----- | ---- | --------- |
| Routing, State, extractors, errors, WS | `references/guide.md` | Implementing or refactoring handlers |
| Auth, CORS, headers, hardening | `references/security.md` | Auth, public API, production deploy |
| Unit/integration tests | `references/testing.md` | Writing or fixing tests |
| Clippy, fmt, CI, features | `references/lint-tooling.md` | Tooling,