What problem does it solve?
Role-based authorization is missing or inconsistent when new routes or tRPC/Next handlers are added, which can accidentally expose staff or owner functionality to the wrong users.
Core Features & Use Cases
- Consistent role model: Defines the canonical roles (
customer, staff, manager, owner) and how they map to sign-in surfaces across the web PWA and admin.
- Defense-in-depth authorization: Guides you to choose the right guard layer (proxy redirect, Server Component role checks, tRPC procedure role enforcement, or Next
/api handler role enforcement) instead of relying on a single check.
- Safe, repeatable onboarding: Explains how to seed the first owner so dev-only routes remain protected until explicitly configured.
Quick Start
When you add a new protected admin page or tRPC mutation, select the appropriate guard (layout requireRole plus the matching staffProcedure/managerProcedure/ownerProcedure) and never rely on proxy.ts alone.