You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feature: Enable a configurable worldwide leaderboard #187
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 worldwide leaderboard 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.example and 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! ✨
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
Worldwide route/state./leaderboard/worldwide ranks users from all countries together. The DB layer already supported the worldwide slug, so the work was around it.
Runtime limit. New variable WORLDWIDE_LEADERBOARD_DISPLAY_LIMIT controls how many users are shown. If it is missing, non-numeric, zero, negative or a decimal, it falls back to 100. Country leaderboards keep using LEADERBOARD_DISPLAY_LIMIT (default 500).
Shared helper. A new services/display-limit.ts is used by both leaderboard-service.ts (page/API) and calculate-leaderboard.ts, replacing duplicated limit logic.
Title fix. The result title is now "Worldwide" instead of the raw slug.
UI. The worldwide page shows its own heading and description (English and Arabic). The worldwide SEO description no longer says "country ranking".
Count fix. The "N country leaderboards" count on /leaderboard no longer counts worldwide as a country.
Discoverability. A featured "Worldwide leaderboard" card sits at the top of /leaderboard. It is removed from the normal country grid and country search.
Docs..env.example and README.md document the new variable (and the previously undocumented LEADERBOARD_DISPLAY_LIMIT).
Tests. 9 new unit tests for the limit logic.
How I verified it
tsc --noEmit: clean
ESLint on the touched folders: clean
Vitest: all tests pass (140)
Manual check in the browser: [fill in after running locally: heading, count, ranking, limit variable]
How to try it
cp .env.example .env and set GITHUB_TOKEN
pnpm db:up && pnpm redis:up, then pnpm leaderboard:calculate if the database is empty
pnpm run dev, then open /leaderboard and click the Worldwide card
Set WORLDWIDE_LEADERBOARD_DISPLAY_LIMIT=3, restart, and confirm only 3 users show
Questions for you
Default limit. Is 100 a sensible fallback for worldwide, or would you prefer another number (for example 50 or 500)?
Entry point. Is the featured card at the top of /leaderboard the right placement? Should I also add a link in the site header?
Cache behavior. The cache stores results per slug and slices to the current limit. Lowering the variable takes effect immediately, but raising it may need the cache to refresh first. Is that acceptable, or should the limit be part of the cache key?
Arabic text. I wrote the new Arabic strings myself. Could a native speaker review them?
Scope. Is there anything in the issue I missed, or anything you would like added (for example a worldwide link in the sitemap or a top-N note on the page)?
Notes
No scoring logic or database code was changed.
Worldwide is computed from existing user rows, so the background worker needs no extra work for it.
Thanks for taking a look. I'm happy to adjust anything before opening the PR.
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: