Lesson 4 of 15
35. Design a Leaderboard (Top-K)

35.3 What are the doors?

3 min read+10 XP

Step 3: API and data model (10 minutes)

GET /v1/contests/{id}/leaderboard?limit=100 returns: { "updated_at": "...", "entries": [ {"rank": 1, "team": "...", "points": 578.0}, ... ] } GET /v1/contests/{id}/me returns: { "rank": 2346, "points": 412.5, "percentile": "top 12%", "updated_at": "..." } (internal) POST /v1/match/{id}/events { "player": "p0", "event": "six", "points": 6 }

Both reads return updated_at so the app can say "updated 12 s ago" honestly.