hashgraph-online/awesome-codex-plugins / plugins/alpoxdev/hypercore/skills/hyper-architecture
hyper-architecture
Verified[Hyper] Use this skill when the user asks for architecture, project setup, or performance work - building, auditing, restructuring, or reviewing project structure, routes, data or server boundaries, the lint/format/type tooling baseline (oxlint, Prettier, tsconfig, rustfmt, clippy), or build and runtime performance - in a Next.js App Router, TanStack Start, Vite with TanStack Router, Astro, Expo, Lynx (ReactLynx), Hono, Axum, Tauri v2, Electron, or Rust CLI, WASM, or MCP server project. It detects the stack from manifests and config files, routes each touched package of a monorepo separately, and applies the matching bundled stack guide, the shared setup baseline, and that stack's performance rules. Do not use it for stacks outside those eleven or for work that crosses no architecture, setup, or performance boundary, such as copy edits, a plain dependency bump, or one build failure.
references/official/axum/tower-docs.md
View on GitHub# tower and tower-http Official Docs Summary
last_verified_at: 2026-11-05
## Contents
- Stable package snapshot
- Confirmed points from official docs
- Layer ordering rules/axum
- How this affects the skill
- Sources
## Stable package snapshot
Verified from docs.rs and crates.io metadata on 2026-11-05.
| Package | Stable | Notes |
|---|---:|---|
| `tower` | 0.5.3 | `Service`, `Layer`, `ServiceBuilder`, `ServiceExt` behind the `util` feature |
| `tower-http` | 0.7.1 | Trace, CORS, compression, timeout, request-id, limit, and static-file layers |
| `tower-layer` | 0.3.x | `Layer` trait used by all tower middleware |
| `tower-service` | 0.3.x | `Service` trait |
Installed `Cargo.lock` wins. Layer feature names differ per middleware, so check the installed crate's feature list before adding one.
## Confirmed points from official docs
1. axum has no bespoke middleware system; it integrates tower. All tower and tower-http middleware work with axum.
Source: [axum middleware](https://docs.rs/axum/latest/axum/middleware/index.html)
2. `ServiceBuilder` composes layers so that the first `.layer()` added receives the request first. `Router::layer` applies to previously added routes, so the last `.layer()` call is outermost.
Source: [axum middleware ordering](https://docs.rs/axum/latest/axum/middleware/index.html), [ServiceBuilder](https://docs.rs/tower/latest/tower/struct.ServiceBuilder.html)
3. `ServiceExt::oneshot` consumes a service and calls it once when ready. It is the standard way to test a router without a socket.
Source: [ServiceExt](https://docs.rs/tower/latest/tower/util/trait.ServiceExt.html)
4. A layer whose service can return an error must be paired with `HandleErrorLayer`, because axum expects infallible services. `TimeoutLayer` and rate-limit layers are the common cases.
Source: [axum middleware error handling](https://docs.rs/axum/latest/axum/middleware/index.html), [HandleErrorLayer](https://docs.rs/axum/latest/axum/error_handling/struct.HandleErrorLayer.html)
5. `tower-http` provides `TraceLayer`, `CorsLayer`, `CompressionLayer`, `TimeoutLayer`, `SetRequestIdLayer`, and `PropagateRequestIdLayer` as ready-made layers.
Source: [tower-http](https://docs.rs/tower-http/latest/tower_http/)
6. `ServiceBuilder::map_request`, `map_response`, `then`, and `and_then` cover small ad-hoc transformations without writing a `Service` impl.
Source: [axum middleware](https://docs.rs/axum/latest/axum/middleware/index.html)
## Layer ordering rules/axum
| Composition | Request order |
|---|---|
| `router.layer(A).layer(B).layer(C)` | C, B, A, handler |
| `ServiceBuilder::new().layer(A).layer(B).layer(C)` | A, B, C, handler |
| `route_layer` | Runs only when a route matches |
| `layer` | Runs for matched and unmatched paths, including the fallback |
Response order is the reverse of request order in every case.
## How this affects the skill
- The skill requires the layer stack to be readable top to bottom, which favors `ServiceBuilder`.
- `route_layer` versus `layer` is a gate because it changes whether authentication or tracing observes 404s.
- `HandleErrorLayer` placement is checked whenever a fallible layer is present.
## Sources
> Checked 2026-11-05.
| Claim | Source | Checked |
|---|---|---|
| axum uses tower and tower-http middleware | <https://docs.rs/axum/latest/axum/middleware/index.html> | 2026-11-05 |
| `ServiceBuilder` ordering | <https://docs.rs/tower/latest/tower/struct.ServiceBuilder.html> | 2026-11-05 |
| `ServiceExt::oneshot` | <https://docs.rs/tower/latest/tower/util/trait.ServiceExt.html> | 2026-11-05 |
| `HandleErrorLayer` and fallible layers | <https://docs.rs/axum/latest/axum/error_handling/struct.HandleErrorLayer.html> | 2026-11-05 |
| tower-http layer inventory | <https://docs.rs/tower-http/latest/tower_http/> | 2026-11-05 |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |