Skip to content

[FEAT] Add Upstash Redis caching layer for GitHub API responses #234

@Priyanshu-byte-coder

Description

@Priyanshu-byte-coder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgssoc26GSSoC 2026 contributionlevel:advancedGSSoC: Advanced difficulty (55 pts)type:performanceGSSoC type bonus: performance (+15 pts)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions