devtrack icon indicating copy to clipboard operation
devtrack copied to clipboard

[FEAT] Add org/team analytics mode — aggregate stats across GitHub org members

Open Priyanshu-byte-coder opened this issue 6 months ago • 6 comments

Summary

Allow a GitHub organisation owner to view aggregated DevTrack stats for all org members: total org commits, combined streak distribution, PR velocity, and most active contributors.

Motivation

Engineering managers want team-level visibility. DevTrack currently only tracks individual stats.

Acceptance Criteria

  • [ ] New page: /org/[orgName] — public, similar to /u/[username]
  • [ ] Data from GitHub API: GET /orgs/{org}/members + per-member contribution data
  • [ ] Stats shown:
    • Total commits across all members (last 30 days)
    • Active contributors count (at least 1 commit)
    • Streak leaderboard: top 5 members by current streak
    • Combined PR metrics
  • [ ] Paginate member list (max 30 members per org for API budget)
  • [ ] Results cached in Supabase for 1 hour
  • [ ] Rate limit budget shared via token pool
  • [ ] Unauthenticated access (public org stats only)
  • [ ] Empty state if org has no public members

Files to Touch

  • New: src/app/org/[orgName]/page.tsx
  • New: src/app/api/public/org/[orgName]/route.ts

Priyanshu-byte-coder avatar May 16 '26 19:05 Priyanshu-byte-coder

Hi @Priyanshu-byte-coder I would like to work on this issue, please assign this issue to me under lable: gssoc:approved as well.

abdullahxyz85 avatar May 17 '26 02:05 abdullahxyz85

Hi @Priyanshu-byte-coder , I’d like to work on this. I reviewed the existing API routes (/api/metrics/contributions, /api/metrics/prs, /api/metrics/streak) along with the current Supabase setup, and this is the implementation approach I’m planning:

  • src/app/api/public/org/[orgName]/route.ts

    • Fetch organization members using GET /orgs/{org}/members (paginated, capped at 30 users initially)
    • Aggregate per-member metrics using the same GitHub API patterns already used in the existing metrics routes
    • Cache aggregated org-level responses in Supabase with a 1-hour TTL to reduce GitHub API usage
  • src/app/org/[orgName]/page.tsx

    • Public-facing page (no auth required)

    • Display:

      • Total commits
      • Active contributors
      • Streak leaderboard (top 5)
      • Combined PR metrics

Since this is a fairly advanced issue, I wanted to confirm a few architectural details before I start implementation:

  1. For Supabase caching, would you prefer:

    • a dedicated table (e.g. org_stats_cache)
    • or reusing an existing caching/storage pattern already present in the codebase?
  2. For contributor activity aggregation, should I:

    • reuse the same GitHub Search Commits API pattern used in /contributions
    • or switch to GitHub GraphQL contribution APIs for better aggregation efficiency?
  3. Is there already a shared GitHub token rotation/pool mechanism in the project, or should I use GITHUB_TOKEN directly from env for this route?

Thanks — once I get clarity on these, I’ll start implementation.

Subhra-Nandi avatar May 18 '26 05:05 Subhra-Nandi

Hi @Priyanshu-byte-coder please merge my three (3) recent PR as well and add label: gssoc approved and levels on them 🙏

abdullahxyz85 avatar May 19 '26 11:05 abdullahxyz85

Reassigning to @Subhra-Nandi — this issue had no PR and no activity for over a month, so it's going to the next person who asked for it (first come, first served).

@Subhra-Nandi it's yours: please open a PR within 7 days or it'll be released again. If you're no longer interested, just say so and I'll pass it on.

Priyanshu-byte-coder avatar Jul 29 '26 17:07 Priyanshu-byte-coder

Hey @Subhra-Nandi — this issue was assigned a while back with no recent activity. Unassigning so it's available for Hacktoberfest contributors. Still working on it? Comment and we'll reassign you.

Priyanshu-byte-coder avatar Oct 14 '26 18:10 Priyanshu-byte-coder

Assigned to @Priyanshu-byte-coder! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!

github-actions[bot] avatar Oct 14 '26 18:10 github-actions[bot]