feature: Enable a configurable worldwide leaderboard #187
Copy link
Copy link
Closed
Description
The leaderboard currently focuses on country-specific rankings. We should add support for a worldwide leaderboard that aggregates users globally and limits the number of displayed users through a runtime environment variable.
Tasks
- Add support for a
worldwideleaderboard route/state in the leaderboard data flow. - Query users across all countries when the selected leaderboard slug is
worldwide. - Add a runtime environment variable (e.g.,
WORLDWIDE_LEADERBOARD_DISPLAY_LIMIT) to control how many users are shown. - Apply a sensible fallback limit when the runtime variable is missing or invalid.
- Update
.env.exampleand relevant documentation with the new variable. - Verify the UI handles the worldwide leaderboard title, count, and ranking correctly.
Tip
🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨
Reactions are currently unavailable
Activity
1-DARK commentedon Oct 8, 2026
assign me
github-actions commentedon Oct 8, 2026
🎉 Issue assigned to @1-DARK! Happy coding!
1-DARK commentedon Oct 9, 2026
Worldwide Leaderboard:
Hi! I've implemented the worldwide leaderboard described in the issue. Before I open the PR, I'd like your feedback on the approach and a few small decisions. Are you satisfied with it, or would you like anything changed?
What I implemented
/leaderboard/worldwideranks users from all countries together. The DB layer already supported theworldwideslug, so the work was around it.WORLDWIDE_LEADERBOARD_DISPLAY_LIMITcontrols how many users are shown. If it is missing, non-numeric, zero, negative or a decimal, it falls back to 100. Country leaderboards keep usingLEADERBOARD_DISPLAY_LIMIT(default 500).services/display-limit.tsis used by bothleaderboard-service.ts(page/API) andcalculate-leaderboard.ts, replacing duplicated limit logic./leaderboardno longer countsworldwideas a country./leaderboard. It is removed from the normal country grid and country search..env.exampleandREADME.mddocument the new variable (and the previously undocumentedLEADERBOARD_DISPLAY_LIMIT).How I verified it
tsc --noEmit: cleanHow to try it
cp .env.example .envand setGITHUB_TOKENpnpm db:up && pnpm redis:up, thenpnpm leaderboard:calculateif the database is emptypnpm run dev, then open/leaderboardand click the Worldwide cardWORLDWIDE_LEADERBOARD_DISPLAY_LIMIT=3, restart, and confirm only 3 users showQuestions for you
/leaderboardthe right placement? Should I also add a link in the site header?Notes
Thanks for taking a look. I'm happy to adjust anything before opening the PR.
Screnshots
O2sa commentedon Oct 9, 2026
Hi @1-DARK
I think you already implemented the feature as expected.
The answer of your questions: