Skip to content

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

Open

Description

@AvishkarPatil

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

Activity

  1. github-actions commented on Jan 3, 2026

    @github-actions

    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! 🚀

  2. SampurnaNiyogi commented on Jan 4, 2026

    @SampurnaNiyogi

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

  3. AvishkarPatil commented on Jan 4, 2026

    @AvishkarPatil
    OwnerAuthor

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

  4. SampurnaNiyogi commented on Jan 5, 2026

    @SampurnaNiyogi

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

MediumRequires some experienceSWOCPart of Social Winter of CodeSWoC26Social Winter of Code 2026enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions