Examples
The examples cover a framework-independent Tower service, fixed-window counters, and GCRA policies. Every page below embeds the complete source file used by the repository, so the documentation and the compiled example cannot drift independently.
| Example | What it demonstrates | Required features |
|---|---|---|
| Tower with MemoryStore | Minimal Tower Layer composition | memory |
| Axum with nested policies | ConnectInfo, global and route-scoped policies | axum,memory |
| Trusted proxy client IP | Peer-policy-gated client-IP extraction behind a trusted proxy | axum,memory |
| Axum with Redis | Shared fixed-window state, namespace, custom error responses | axum,redis,runtime-tokio |
| Axum with Memory GCRA | Process-local burst quota and application-owned periodic cleanup | axum,memory-gcra |
| Axum with Redis GCRA | Shared burst quota through ordinary Redis | axum,redis-gcra,runtime-tokio |
Run an example from the repository root with the command shown on its page. The Axum examples start
an HTTP server and keep running until interrupted. The Redis examples additionally require
REDIS_URL to reference a reachable Redis server.
These programs are intentionally small. They demonstrate the limiter boundary, not production authentication, proxy configuration, connection supervision, observability, or graceful shutdown. Review the Production guide before adapting them to a deployed service.