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

  1. API routes (/api/github-profile, /api/project-repos) fetch with fetch + auth header.
  2. Aggregate minimal fields (name, login, avatar, followers/following, stars, forks).
  3. SWR on client with a long dedupingInterval (15 min+) prevents thrash.
  4. 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.error before 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.