The System Design Newsletter

The System Design Newsletter

How JWT Works ✨

#71: Break Into JSON Web Token (3 Minutes)

Neo Kim's avatar
Neo Kim
May 10, 2025

Get my system design playbook for FREE on newsletter signup:


This post outlines how JSON Web Token works. You will find references at the bottom of this page if you want to go deeper.

  • Share this post & I'll send you some rewards for the referrals.

Note: This post is based on my research and may differ from real-world implementation.

Once upon a time, there lived a software engineering student named Keiko.

Although extremely bright, she never worked on any real-world projects.

So she struggled with coding.

How JWT Works

Until one day, when she decided to build a weather app.

And shared it with her friends.

Yet she had no idea how user authorization worked.

HTTP is stateless; it means each request should include the necessary information.

And her friends had to enter their username and password on each page for authorization.

It was frustrating.

Session Store Tracking User Sessions
Session Store Tracking User Sessions

So she set up a session store on the server:

  • It tracks user sessions and gives a session ID to the client.

  • And the client includes the session ID with each request header.

The server then checks the session store to identify the client for access.

Although it temporarily solved the authorization problem, there were newer issues.

Her tiny app became popular among university students across the world.

So she had to install more servers and put them behind a load balancer.

But it became difficult to manage sessions with many servers.

Because the load balancer might route requests from a user to different servers.

Sticky Sessions to Route Requests From a User to the Same Server
Sticky Sessions to Route Requests From a User to the Same Server

So she set up sticky sessions. It means routing requests from a specific user to the same server using their user ID or IP address.

Yet it doesn’t scale well because of stateful servers and uneven load distribution.

Shared Session Store for Tracking User Sessions Across Servers
Shared Session Store for Tracking User Sessions Across Servers

So she installed a shared session store. It keeps session data separate in a central store.

A shared session store allows stateless servers. But introduces coupling and becomes a single point of failure.

So she set up JSON Web Token (JWT) for authorization.

Authentication vs Authorization
Authentication vs Authorization

Think of JWT as a badge to enter a building. A user gets the badge from the front desk after verification. Then they can access authorized rooms without verifying their identity again.

The server doesn’t store session information with JWT. Instead JWT includes necessary authorization information, and the server checks the JWT on each request.

Imagine authentication as permission to enter a building. And authorization as the permission to enter specific rooms of the building.

Onward.


Linear: Issue tracking without the noise - Sponsor

Simple, robust, and blazingly fast.

Linear is purpose-built for engineers:

  • Create issues in seconds

  • Automate your Git workflows

  • Navigate your entire workflow with keyboard shortcuts

Less grunt work, less context switching. More focus, more flow. See for yourself with $250 off.

Explore Linear


How JWT Works

Let’s dive in:

Subscribe for free to continue reading

Enter your email and get every post from The System Design Newsletter.
Already have an account? Sign in
© 2026 Neo Kim · Publisher Privacy
Substack · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture