Problem Statement
Currently, OrgExplorer relies on GitHub REST API calls to fetch repository lists, metrics, and contributor data. While local IndexedDB caching is implemented, expired cache entries trigger full network re-fetches.
For unauthenticated users (limited to 60 requests/hour) and authenticated users (5,000 requests/hour), repeated re-fetching rapidly exhausts GitHub API rate limits, especially when exploring large organizations with dozens of repositories.
Proposed Solution
1. ETag-based Conditional Requests (If-None-Match)
- Store the
ETag header along with cached payloads in IndexedDB (src/services/cache.js).
- When a cached item expires, send a conditional request using the
If-None-Match: <etag> header.
- If data has not changed, GitHub responds with
304 Not Modified, which costs 0 points against the GitHub rate limit quota.
- Upon receiving a
304, refresh the local cache TTL and immediately return the stored data without re-downloading the payload.
2. Request Throttling & Batching
- Throttle sequential/parallel API calls to prevent triggering GitHub secondary rate limits when navigating through repository-heavy organizations.
3. Graceful Rate Limit Handling
- Read
x-ratelimit-remaining and x-ratelimit-reset headers from responses to dynamically adjust UI feedback and throttle rates before hard failures happen.
Files to be Modified
src/services/github.js
src/services/cache.js
Benefits
- Prevents unnecessary API quota consumption on recurring visits and stale-check cycles.
- Significantly speeds up page loads for returning visitors.
- Provides a smoother and more resilient user experience across the app.
Problem Statement
Currently,
OrgExplorerrelies on GitHub REST API calls to fetch repository lists, metrics, and contributor data. While local IndexedDB caching is implemented, expired cache entries trigger full network re-fetches.For unauthenticated users (limited to 60 requests/hour) and authenticated users (5,000 requests/hour), repeated re-fetching rapidly exhausts GitHub API rate limits, especially when exploring large organizations with dozens of repositories.
Proposed Solution
1. ETag-based Conditional Requests (
If-None-Match)ETagheader along with cached payloads in IndexedDB (src/services/cache.js).If-None-Match: <etag>header.304 Not Modified, which costs 0 points against the GitHub rate limit quota.304, refresh the local cache TTL and immediately return the stored data without re-downloading the payload.2. Request Throttling & Batching
3. Graceful Rate Limit Handling
x-ratelimit-remainingandx-ratelimit-resetheaders from responses to dynamically adjust UI feedback and throttle rates before hard failures happen.Files to be Modified
src/services/github.jssrc/services/cache.jsBenefits