Summary
Every dashboard load fires multiple GitHub API calls. With the 5000 req/hr rate limit shared across all routes, heavy users and repeated refreshes can hit the limit quickly. Redis caching would drastically reduce API calls.
Expected Behaviour
- First request hits GitHub API and caches response in Redis with TTL
- Subsequent requests within TTL return cached data instantly
- TTL per endpoint: contributions (5min), repos (10min), PRs (10min), streak (2min)
- Cache key: {userId}:{endpoint}:{params}
- Cache invalidation: user-triggered sync bypasses cache and refreshes it
Implementation Notes
- Use @upstash/redis and @upstash/ratelimit packages
- Add UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN to .env
- Create a cache wrapper: cacheGet/cacheSet utilities in lib/cache.ts
- Each /api/metrics route uses the cache wrapper before calling GitHub API
GSSoC Info
- Difficulty: Advanced — 55 pts
- Area: Performance / Infrastructure
Summary
Every dashboard load fires multiple GitHub API calls. With the 5000 req/hr rate limit shared across all routes, heavy users and repeated refreshes can hit the limit quickly. Redis caching would drastically reduce API calls.
Expected Behaviour
Implementation Notes
GSSoC Info