Two ways to remember a user is logged in. The debate is eternal; in practice the choice is simple for a typical SaaS.
revocable.
scalable.
By default, for a SaaS, I go with sessions: being able to log a user out immediately beats the stateless elegance of JWT.
Middleware protects groups of routes at once (redirect if no session). But it doesn’t replace the check in each API route: middleware guards the door, the route guards the safe.
Never rely on middleware alone for data security: every route must re-check session AND resource ownership. That’s the IDOR flaw from the basic security holes.
Login rate limiting has its own article: rate limiting and API protection.