Why go_router_guards?
go_router_guards provides a middleware‑style guard system built for Go Router.
Why this package?
Section titled “Why this package?”- Unified guard model works for both type‑safe and traditional routes.
- Composable pipelines (
guardAll
,guardAnyOf
,guardOneOf
) keep logic modular. ConditionalGuard
targets paths without duplicating logic.- Clear separation of concerns: guards decide, router executes.
When to use
Section titled “When to use”- Authentication/authorization checks before navigation.
- Feature flags, maintenance mode, or runtime constraints.
- Async rules (API checks, storage reads) that must resolve before continuing.
When not to use
Section titled “When not to use”- Pure view‑only state changes (prefer in‑page logic).
- If your app has no pre‑navigation constraints.
See Core Concepts and the Get Started guide to try it out.