GitHub API Rate Limits
GitHub enforces rate limits on API requests to ensure fair usage and system stability. GitScope provides real-time visual indicators to help you monitor your consumption.Rate Limit Tiers
GitHub API rate limits vary based on authentication:| Authentication Type | Requests per Hour | Use Case |
|---|---|---|
| No authentication | 60 | Quick browsing, limited usage |
| Personal Access Token | 5,000 | Standard authenticated use |
| GitHub App | 15,000 | High-volume integrations |
GitScope uses Personal Access Tokens, which provide 5,000 requests per hour when configured.
How GitScope Tracks Rate Limits
Every response from the GitHub API includes rate limit headers. GitScope automatically extracts and displays this information.Implementation Details
TheuseGitHub hook extracts rate limit data from response headers:
src/hooks/useGitHub.js
Response Headers
GitHub includes three key headers in every API response:x-ratelimit-remaining- Number of requests left in the current windowx-ratelimit-limit- Maximum requests allowed per hourx-ratelimit-reset- Unix timestamp when the limit resets
The
reset timestamp is converted from seconds to milliseconds (* 1000) to match JavaScript’s Date object format.Visual Indicators
GitScope displays rate limit information prominently in the application header.Header Component Display
src/components/Header.jsx
Color Coding System
The rate limit indicator uses a traffic light system:Green Zone (>50%)
Healthy: You have plenty of requests remaining. Safe to continue normal usage.Color:
var(--green) - #10b981 (light) / #3fb950 (dark)Yellow Zone (20-50%)
Caution: You’re using more than half your quota. Consider slowing down or waiting for reset.Color:
var(--yellow) - #f59e0b (light) / #d29922 (dark)Request Consumption Patterns
Understanding how GitScope uses API requests helps you manage your quota:Per User Search
| Action | Endpoint | Requests |
|---|---|---|
| Load user profile | GET /users/:username | 1 |
| Load first page of repos | GET /users/:username/repos | 1 |
| Each additional page | GET /users/:username/repos?page=N | 1 per page |
Per Repository Interaction
| Action | Endpoint | Requests |
|---|---|---|
| View commits | GET /repos/:owner/:repo/commits | 1 |
| Load language stats | GET /repos/:owner/:repo/languages | 1 |
Language Chart
TheLanguageChart component fetches language data for up to 12 repositories in parallel:
src/components/LanguageChart.jsx
The language chart caches results in memory (
useRef) to avoid duplicate requests during the same session.Example Scenario
Searching for a user with 100 repositories:- Initial search:
2requests (user + first 30 repos) - Language chart:
12requests (fetches for first 12 repos) - Clicking a repo:
1request (commits) - Loading page 2:
1request (next 30 repos)
Rate Limit Reset
How Reset Works
GitHub rate limits operate on a rolling window basis:- Limits reset exactly one hour after your first request in the current window
- The reset time is provided in the
x-ratelimit-resetheader - You can see the exact reset time by hovering over the rate limit indicator
Tooltip Display
The rate limit button shows the reset time on hover:resetTime is formatted as a localized time string:
Handling Rate Limit Errors
When you exceed your rate limit, GitHub returns a403 Forbidden response:
src/hooks/useGitHub.js
ErrorBanner component:
src/App.jsx
Token Hint for Unauthenticated Users
If you’re using GitScope without a token, you’ll see a helpful hint:src/App.jsx
- No token is stored in localStorage
- The user is viewing repository data
- Reminds users they’re limited to 60 requests/hour
Best Practices
Monitor the Indicator
Keep an eye on the color-coded rate limit in the header. Slow down if it turns yellow or red.
Implement Caching
GitScope caches language data - consider similar patterns for your own integrations.
Troubleshooting
Rate Limit Not Showing
- Ensure you’ve made at least one API request (search for a user)
- Check browser console for errors in the network tab
- Verify the
useGitHubhook is properly extracting headers
Wrong Limit Displayed
- If showing
60: You’re unauthenticated or token is invalid - If showing
5000: Token is working correctly - If showing
15000: You’re using a GitHub App (uncommon)
Hitting Limits Quickly
- The language chart fetches data for 12 repos simultaneously
- Each page of repos counts as one request
- Viewing multiple users in quick succession consumes quota rapidly
- Consider waiting for the reset time or reducing parallel requests
Next Steps
API Token Setup
Configure your token to increase rate limits to 5,000/hour
Themes
Customize your visual experience with dark mode