Recipes
Copy-paste solutions to common problems.
Each recipe is a self-contained, runnable example. Pick one, copy the code, adapt the names — done.
Multi-platform / multi-tenant production patterns
- Multi-platform login with guards — admin / portal / mobile served from one backend, with origin-aware login gating.
- Seeding roles & permissions — idempotent bootstrap of
isSystemroles per guard.
Extending the auth lifecycle
- React to a new signup with
UserRegisteredEvent— create yourAppUser, link a referral, queue a welcome email. - React to login with
UserLoggedInEvent— last-login tracking, role sync, audit writes. - Custom OAuth provider — extend
BaseAuthProvider. - Extra signup fields with
collectProfileFields. - Pre-built React login / signup / MFA / forgot-password forms.
Schema & migration
Frontend integration
- Next.js dashboard behind
<RequireRole>. - Tenant-picker dropdown.
- Remember-this-device with trusted-device tokens.
Tokens & sessions
Notifications
Identity & accounts
Configuration
- Per-request config (mobile vs web).
- Custom error transformation per flow.
- Custom trusted-device header name.