[FEAT] Add org/team analytics mode — aggregate stats across GitHub org members
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
Hi @Priyanshu-byte-coder I would like to work on this issue, please assign this issue to me under lable: gssoc:approved as well.
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
- Fetch organization members using
-
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:
-
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?
- a dedicated table (e.g.
-
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?
- reuse the same GitHub Search Commits API pattern used in
-
Is there already a shared GitHub token rotation/pool mechanism in the project, or should I use
GITHUB_TOKENdirectly from env for this route?
Thanks — once I get clarity on these, I’ll start implementation.
Hi @Priyanshu-byte-coder please merge my three (3) recent PR as well and add label: gssoc approved and levels on them 🙏
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.
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.
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!