leaderboard-system

Combine Redis ZSETs with MySQL metrics for scoped leaderboard pagination and privacy-aware rows.

132|42|Updated Aug 19, 2020
One-click install
npx skills add https://github.com/OpenLitterMap/openlittermap-web --skill leaderboard-system
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: leaderboard-system
Source: https://github.com/OpenLitterMap/openlittermap-web/tree/main/.ai/skills/leaderboard-system
Command: npx skills add https://github.com/OpenLitterMap/openlittermap-web --skill leaderboard-system

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides scalable, real-time leaderboards and per-user metrics for time-filtered rankings, ensuring fast global and scoped queries while preserving privacy controls.

Core Features & Use Cases

  • All-time leaderboards stored in Redis ZSETs for fast global rankings.
  • Time-filtered leaderboards using MySQL metrics table with deterministic pagination.
  • Per-user rows and privacy-aware formatting across teams and scopes.

Quick Start

Configure and activate the Leaderboard system on your app to initialize Redis keys and MySQL structures, then call the leaderboard API with a chosen time filter and location scope.

Frequently Asked Questions about leaderboard-system

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a real-time leaderboard with time-filtered history?▼

To build a real-time leaderboard, combine Redis ZSETs for fast all-time rankings with a MySQL metrics table for time-filtered data, applying deterministic pagination for ties. This hybrid approach ensures fast global queries while maintaining scoped historical data.

How does deterministic pagination work for tied leaderboard rankings?▼

Deterministic pagination for tied rankings resolves equal scores consistently by combining the user's score with a unique identifier from the per-user row. This ensures users sharing the same XP value appear in a stable order across paginated requests.

Do I need Redis and MySQL to handle global and city-scoped leaderboards?▼

Yes, you need Redis and MySQL to handle scoped leaderboards effectively. Redis ZSETs provide fast all-time global rankings, while MySQL stores the time-filtered metrics table required to query country, state, and city scopes accurately.

What is the best way to implement privacy rules in a per-user leaderboard?▼

The best way to implement privacy rules in a per-user leaderboard is to use dedicated services that build per-user rows and enforce privacy-aware formatting before returning data. This ensures user data is protected across all team and location scopes.

Why use Redis ZSETs for all-time rankings instead of a relational database?▼

Redis ZSETs are used for all-time rankings because they provide highly scalable, real-time sorted sets that outperform relational databases in global ranking queries. MySQL is then paired with Redis specifically to handle time-filtered historical data.