Why did you choose Redis sessions instead of JWT access tokens?
After this you can answer: Why did you choose Redis sessions instead of JWT access tokens?
Say it in 30 seconds
Section titled “Say it in 30 seconds”The deeper answer
Section titled “The deeper answer”The session record contains the user identity and creation time, not a trusted copy of the user’s role. The raw identifier has 32 random bytes; only its SHA-256 hash forms the Redis session key. Both the cookie lifetime and stored session lifetime are seven days.
A per-user sorted set records active session hashes. Reads require membership as well as the session record. Losing the index therefore invalidates sessions instead of reviving a token that was meant to be revoked. A login rotates the identifier and deletes the previous record.
JWT is a format, not a complete session policy. For another system, I would ask about issuer boundaries, acceptable revocation delay, browser storage and key rotation before choosing. Short-lived tokens with refresh sessions are another valid design, with more moving parts.
Counter-questions
Section titled “Counter-questions”Does HttpOnly prevent all XSS harm?
What happens during a Redis outage?
Can more API tasks share these sessions?
Where in MiniTickets
Section titled “Where in MiniTickets”Read Auth sessions, then inspect the sessions piece →.
apps/api/src/queries/sessions.ts → getRead this book online: https://book.theversehub.in/