How to add TOTP-based two-factor authentication to a Next.js SaaS with Drizzle ORM -- generating secrets, rendering QR codes, validating codes at login, and issuing backup codes so users never get locked out.
How to add role-based access control to a Next.js SaaS with Drizzle ORM -- a role enum on the user, a requireRole() helper in the service layer, and route guards that fail fast without leaking data.
How to build an in-app notification system in a Next.js SaaS with Drizzle ORM -- a schema that supports any event type, an unread count badge that polls without a WebSocket server, and a mark-as-read endpoint your frontend can call from anywhere.
How to add a customer-facing webhook system to a Next.js SaaS -- storing endpoints per user, signing payloads with HMAC-SHA256, queuing deliveries as a background job, and retrying failed requests with exponential backoff using Drizzle ORM.
How to gate features by Stripe subscription plan in a Next.js SaaS -- storing the plan on the user, checking it in the service layer, and enforcing per-plan usage limits so your free tier actually means something.
How to add database-backed feature flags to a Next.js SaaS with Drizzle ORM -- a schema with per-user and per-plan targeting, a service that evaluates flags server-side, and a rollout strategy that requires no redeploy.