Skip to content

Conversation

@standujar
Copy link
Contributor

Add JSON Leaderboard API Endpoints

Summary

This PR adds static JSON API endpoints for leaderboard data, enabling external applications, mobile apps, and third-party integrations to consume leaderboard information programmatically.

Features

  • Three time periods: Monthly, weekly, and lifetime leaderboards
  • Comprehensive scoring: Includes total score plus breakdown by contribution type (PR, issue, review, comment)
  • Wallet addresses: Includes Solana and Ethereum wallet addresses from GitHub profiles
  • Calendar-based periods:
    • Weekly: Sunday to today
    • Monthly: 1st of month to today
    • Lifetime: Project start date to today
  • CLI command: bun run pipeline export-leaderboard
  • CI/CD integration: Automatically generates fresh leaderboard data on every deployment
  • Full test coverage: 9 comprehensive tests covering all scenarios

API Endpoints

The following static JSON files will be available via GitHub Pages:

  • /data/api/leaderboard-monthly.json
  • /data/api/leaderboard-weekly.json
  • /data/api/leaderboard-lifetime.json

Response Format

{
  "period": "monthly",
  "startDate": "2025-10-01",
  "endDate": "2025-10-23",
  "generatedAt": "2025-10-23T11:12:25.933Z",
  "totalUsers": 150,
  "leaderboard": [
    {
      "rank": 1,
      "username": "contributor1",
      "avatarUrl": "https://avatars.githubusercontent.com/...",
      "score": 1234.5,
      "prScore": 800.0,
      "issueScore": 200.0,
      "reviewScore": 150.5,
      "commentScore": 84.0,
      "wallets": {
        "solana": "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
        "ethereum": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
      }
    }
  ]
}

Use Cases

  • Mobile apps: Display leaderboard data in native applications
  • Discord bots: Show contributor rankings and stats
  • Analytics dashboards: Track contributor engagement over time
  • Reward systems: Automate token distributions based on rankings
  • Third-party integrations: Enable community-built tools and services

Testing

All tests pass successfully:

  • bun test src/lib/pipelines/export/exportLeaderboardAPI.test.ts

Add static JSON API endpoints for leaderboard data that can be consumed
by external applications, mobile apps, or third-party integrations.

Features:
- Generate leaderboard JSON files for monthly, weekly, and lifetime periods
- Include user rankings, scores (total, PR, issue, review, comment)
- Include wallet addresses (Solana & Ethereum) from GitHub profiles
- Calendar-based periods (Sunday start for weekly, 1st of month for monthly)
- CLI command: `bun run pipeline export-leaderboard`
- Integrated into CI/CD workflow for automatic updates
- Comprehensive test suite (9 tests)

API endpoints will be available at:
- /data/api/leaderboard-monthly.json
- /data/api/leaderboard-weekly.json
- /data/api/leaderboard-lifetime.json
@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@standujar standujar force-pushed the feat/leaderboard-api-clean branch from 3791c26 to a53cbf1 Compare October 23, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant