-
Notifications
You must be signed in to change notification settings - Fork 42
Performance: Implement CDN Cache-Control headers for the API #69
Copy link
Copy link
Open
Labels
GSSoC 2026backendServer-side logic, API routes, data fetching, and core application functionalityServer-side logic, API routes, data fetching, and core application functionalitygood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededperformanceImprovements related to speed, efficiency, caching, and reducing resource usageImprovements related to speed, efficiency, caching, and reducing resource usage
Metadata
Metadata
Assignees
Labels
GSSoC 2026backendServer-side logic, API routes, data fetching, and core application functionalityServer-side logic, API routes, data fetching, and core application functionalitygood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededperformanceImprovements related to speed, efficiency, caching, and reducing resource usageImprovements related to speed, efficiency, caching, and reducing resource usage
📝 Description
Currently, every time a user's GitHub README loads, GitHub's Camo proxy fetches the SVG from our
/api/streakendpoint. Without proper HTTP cache headers, we risk burning through Vercel serverless function invocations and hitting GitHub API rate limits.🎯 What needs to be done
We need to set explicit
Cache-Controlheaders on our Next.js API response. We should use a stale-while-revalidate (SWR) strategy so that the CDN serves a cached SVG instantly, while fetching the fresh data in the background.📍 Where to look
app/api/streak/route.ts(Look at theNextResponsereturn statement).✅ Acceptance Criteria
Cache-Control: public, s-maxage=14400, stale-while-revalidate=86400(Cache for 4 hours, revalidate over 24 hours).