IssueMatch icon indicating copy to clipboard operation
IssueMatch copied to clipboard

[FEATURE] Implement real-time profile statistics from GitHub API

Open AvishkarPatil opened this issue 10 months ago • 4 comments

Feature Description

Replace mock profile statistics (contributions, pull requests, issues closed, stars) with real-time data fetched from GitHub API. Currently, the profile page shows hardcoded numbers that don't reflect actual user activity.

Problem Statement

The profile page displays mock statistics (149 contributions, 86 PRs, 53 issues closed, 128 stars) that are the same for all users. This provides no real value and misleads users about their actual GitHub activity. Users expect to see their genuine contribution metrics.

Proposed Solution

Backend:

  • Create new endpoint: GET /api/v1/github/stats/{username}
  • Fetch real data from GitHub API:
    • Total contributions (from GraphQL API)
    • Pull requests count (search API: author:username type:pr)
    • Issues closed (search API: author:username type:issue is:closed)
    • Total stars received (sum stars from user's repos)
  • Cache results for 1 hour to avoid rate limits
  • Return structured JSON with all stats

Frontend:

  • Update profile page to fetch from new endpoint
  • Replace mock data in mockData.stats object
  • Add loading skeleton while fetching
  • Handle errors gracefully (show "Unable to load stats")

API Endpoints to use:

GET https://api.github.com/users/{username}/repos
GET https://api.github.com/search/issues?q=author:{username}+type:pr
GET https://api.github.com/search/issues?q=author:{username}+type:issue+is:closed

Component

Frontend

Alternative Solutions

No response

Additional Context

Current mock data location: frontend/app/profile/page.tsx line ~70

stats: {
  contributions: 149,
  pullRequests: 86,
  issuesClosed: 53,
  stars: 128,
}

GitHub API rate limits: 5000 requests/hour (authenticated), so caching is essential.

Reference: GitHub's own profile stats implementation

AvishkarPatil avatar Jan 03 '26 22:01 AvishkarPatil

Thank you for creating this issue! šŸŽ‰

This issue is part of Social Winter of Code 2026.

Next Steps:

  • A maintainer will review and assign difficulty labels (Easy/Medium/Hard)
  • Feel free to ask questions in the comments
  • Wait for assignment before starting work

Happy contributing! šŸš€

github-actions[bot] avatar Jan 03 '26 22:01 github-actions[bot]

Hi! I’d like to work on this issue. Could you please assign it to me?

SampurnaNiyogi avatar Jan 04 '26 06:01 SampurnaNiyogi

Hey @SampurnaNiyogi, you can work on this, refer github api docs for this .

AvishkarPatil avatar Jan 04 '26 07:01 AvishkarPatil

@AvishkarPatil I have created a pull request after implementing this. Kindly review it and if everything is fine please merge it under SWOC contribution.

SampurnaNiyogi avatar Jan 05 '26 09:01 SampurnaNiyogi