This is a submission for the Redis AI Challenge: Beyond the Cache.
What I Built
Typing Challenge is a realtime typing practice app with persistent user profiles, per-user test histories, global analytics, leaderboards, and live active typers count. The frontend (React / Next.js) consumes a backend API and WebSocket events. The backend uses Redis 8 as the primary datastore and realtime engine not just as a cache but as the main source of truth for users, test results, leaderboards, active typers, and instant messaging.
Key features:
- Persistent user profiles + last 100 test runs per user.
- Global stats (avg WPM, avg accuracy, total tests, total users).
- Multi-type leaderboards (WPM, accuracy, consistency) using Redis sorted sets.
- Realtime active typers list and count using Redis Sets.
- Realtime progress, session events, and broadcasts using Redis Pub/Sub + Socket.IO.
- Efficient atomic updates using Redis pipelines.
- Simple content store for typing texts (hash) and random text retrieval.
Demo
Demo: link
Backend repository: link
Frontend repository: link
Video Demo
How I Used Redis 8
I relied on Redis as the primary database and realtime layer. Below is a breakdown of the features I used and where they live in the code.
Primary database (data models)
-
Hashes for user profiles and global stats:
-
user:<username>
storestotal_tests
,avg_wpm
,avg_accuracy
,best_wpm
,last_seen
, etc. -
global:stats
stores counters used to compute averages.
-
-
Lists store per-user test history (
LPUSH
+LTRIM
to keep last 100 tests). - Sets track unique users for global stats.
-
Sorted Sets (ZSETs) power the leaderboards by storing scores for
leaderboard:wpm
,leaderboard:accuracy
,leaderboard:consistency
.
Realtime & messaging
-
Pub/Sub: publishes events like
typing:updates
when tests are submitted, stats change, users go online/offline, and typing progress updates. - Socket.IO integrates with Redis so multiple backend instances can stay in sync.
Realtime active typers
-
Sets are used to track currently active typers:
- When a user starts typing, their username is added to
active_typers
(SADD
). - When they stop or disconnect, they’re removed (
SREM
).
- When a user starts typing, their username is added to
- The count (
SCARD active_typers
) and list (SMEMBERS active_typers
) are broadcast via Pub/Sub. - The frontend listens for
active_typers_update
events to instantly update the live counter/list.
Performance & correctness
- Pipelines are used to make updates atomic and efficient.
- Efficient reads: MGET / HMGET fetch multiple values at once.
- Dedicated Pub/Sub client: keeps messaging independent from normal Redis operations.
Why this demonstrates “Beyond the Cache”
This project uses Redis as:
- a primary data store (hashes, lists, sets, zsets),
- a realtime event system (Pub/Sub + Socket.IO),
- an analytics engine for aggregates and leaderboards,
- and an operational presence tracker for active typers.
Architecture diagrams
Team Submission
I worked on this challenge individually.
Conclusion
The Typing Challenge project shows that Redis is far more than a cache it can serve as a primary data store, realtime event bus, analytics engine, and presence tracker all in one.
By combining Hashes, Lists, Sets, Sorted Sets, Pub/Sub, and pipelines, i built a system that delivers:
- millisecond-latency leaderboards,
- instant global stats updates, and
- live active typer tracking all without a traditional SQL or NoSQL database.
Redis 8’s speed, versatility, and rich data structures made it possible to keep the experience fast, consistent, and engaging for users.
This approach can scale horizontally, handle spikes in activity, and power both persistent storage and ephemeral realtime events truly going beyond the cache.
Top comments (3)
it's interesting. I have a lot of issues with the cursor. I find it very hard to understand where it is exactly. Also the prompt doesn't run fluidly. Overall the typing experience is heavily impacted. I'd prefer more an interface like monkeytype.com
Amazing! I've just started my learning journey and can't wait to reach this level one day! Thank you so much for sharing!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.