I wanted a living snapshot of my GitHub activity—followers, key repo stars/forks—without adding a full analytics layer.
Design Constraints
- Keep client bundle lean (no heavy SDK)
- Avoid rate limit surprises
- Cache server-side just enough to feel fresh
Approach
- API routes (
/api/github-profile,/api/project-repos) fetch withfetch+ auth header. - Aggregate minimal fields (name, login, avatar, followers/following, stars, forks).
- SWR on client with a long
dedupingInterval(15 min+) prevents thrash. - Graceful fallback if API fails—UI silently hides metrics.
Caching
Vercel's edge and SWR together reduce repeated hits. Additional in-memory map caches repo slug lookups so project cards display instantly.
UI Integration
- Projects page gets a compact profile card
- Dashboard shows only the essentials (no noisy graphs)
Error Handling
- Try/catch around fetch; on non-200, return
{ error:true } - Client checks
!data.errorbefore rendering
Future Ideas
- Language breakdown mini-bar
- Highlight recently active repos (commit recency)
A small, purposeful slice of data beats a sprawling stats page. This approach keeps the feel of "live" without complexity.