Sessions or JWTs? Why I picked server-side sessions for a 1,000-member platform
I'm building a member platform for a university Christian Union with the MERN stack. Members sign in, and leaders post announcements, approve events and mark attendance. Early on I had to choose between a sessioned site
I'm building a member platform for a university Christian Union with the MERN stack. Members sign in, and leaders post announcements, approve events and mark attendance. Early on I had to choose between a sessioned site (the server remembers you) and a sessionless one (the client carries a signed token). Here is how I decided, and what I learned about speed along the way.
The two models in one minute
With sessions, the server stores your login state and gives you a session ID to present on later requests. With JWTs, the token is self-contained and needs no server-side storage.
What each one costs you
Sessions cost a lookup. Every request needs a session-store lookup, and the cookie stays small, around 32 bytes versus 800+ for a JWT. With several servers, all of them must share the same store.
JWTs cost control. Any server can verify a JWT on its own, so scaling is easy. But revoking one is difficult without a blocklist. Once you add logout, revocation and risk controls, JWT stops being fully stateless.
They fail differently. Sessions tend to crack first around coordination of shared state; tokens fail in other ways, around expiry and revocation.
loginradius
Why I chose sessions
Access has to stop the moment a role ends. In a union, a leader's term ends or an admin removes a role. Deleting a session from the store invalidates it immediately. A JWT would keep working until it expires.
The scale doesn't need statelessness. I expect 1,000 to 2,000 members on one backend. The classic reasons to go sessionless (microservices, multi-client APIs, mobile apps) don't apply to me.
The speed cost is small. I already run Redis for queues and rate limiting. One reported figure is about 1ms for a Redis check per request, in exchange for instant revocation. Measure that on your own setup rather than trusting any single number.
hackernoon
Sockets and background jobs can reuse it. The same session cookie authenticates my real-time connection, so I don't build a second auth system.
Making sessions fast
Keep session data tiny. I store only the user ID and look up roles when needed.
Use Redis, never the database, for session storage.
Set a sensible expiry so abandoned sessions clear themselves.
Cache only public reads (events, ministries). Don't cache per-user data in the same layer.
Use httpOnly, sameSite and secure cookies. This blocks browser scripts from reading the session.
Measure p95 latency before and after any change.
When I'd go sessionless
If I later add a mobile app, third-party API clients or multiple services, I'd use short-lived tokens plus a server-side refresh token. Short expiry limits the damage from a stolen token. The refresh token can be stored server-side, which gives you revocation for that token. In practice, many production systems end up as a hybrid.
The takeaway
Neither model is "the modern one." Sessions give control; tokens give portability. Pick based on what you must be able to switch off instantly, and how many servers you really run.
Next I'm adding email verification and abuse-path tests. What would you test first on an auth system?
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.