Working, runnable code examples that accompany deep-dive articles on devsaas.dev/blog.
Each article on DevSaaS walks through why a problem happens and how to reason about it. This repo is the companion: the actual code you can clone, run with docker compose up, and poke at — so you're not copy-pasting snippets out of a blog post and hoping they work.
| Folder | Article | What it demonstrates |
|---|---|---|
jwt-revocation-redis/ |
Revoke a JWT Before It Expires | Redis-backed token blacklist with automatic TTL cleanup |
refresh-token-reuse-detection/ |
Detecting Refresh Token Reuse with Redis | Refresh token rotation + reuse detection using Redis token families |
Each folder is self-contained:
cd jwt-revocation-redis
docker compose up -d # starts Redis
npm install
npm startEvery example folder has its own README with the exact endpoints to hit and what to expect.
Most "JWT tutorial" code online either skips revocation entirely or hand-waves the storage layer. These examples show the actual Redis data structures, TTL strategy, and edge cases (clock skew, race conditions on logout, token family invalidation) that the DevSaaS articles discuss in depth.
- Node.js 20+
- Express
- Redis 7 (via
ioredis) - Docker Compose for local Redis
MIT — use it, fork it, adapt it to your own stack.
Full write-ups, troubleshooting guides, and architecture breakdowns: devsaas.dev/blog