Typing Challenge - realtime typing leaderboard, analytics, and active typers powered by Redis
Mas'ud Ali

Mas'ud Ali @masud_ali_cc66779de0c2b2

About: I'm a frontend developer passionate about turning ideas into interactive, user-friendly web experiences.

Location:
Malang, East Java, Indonesia
Joined:
Jul 18, 2024

Typing Challenge - realtime typing leaderboard, analytics, and active typers powered by Redis

Publish Date: Aug 10 '25
30 3

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> stores total_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).
  • 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

architecture diagram

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.

Comments 3 total

  • Leo
    LeoAug 14, 2025

    Amazing! I've just started my learning journey and can't wait to reach this level one day! Thank you so much for sharing!

  • Damiano Venturin
    Damiano VenturinAug 15, 2025

    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

  • Jurita
    JuritaAug 15, 2025

    Exciting casual games, high rewards, and a variety of gaming experiences. So, what are you waiting for?
    betway-pk.com/Betway-Platform-Simp...

Add comment