Generate customizable GitHub badges for users and repositories with real-time data, caching, and visual effects.
/badges?username={username}&repo={repo}&name={visitors,total-stars,...}&theme={theme1,theme2,...}&effect={wave|glow}&column={1-50}&size={small|medium|large}&p={0-100}
| Parameter | Default | Description |
|---|---|---|
username |
— | The GitHub username for which to generate badges. |
| Parameter | Default | Range | Description |
|---|---|---|---|
repo |
— | — | The repository name for which to generate badges. Format: repo-name or owner/repo-name. |
name |
— | — | Comma-separated badge names to generate (e.g., visitors,total-stars,repositories). |
theme |
default |
— | Comma-separated theme(s) to apply to badges (e.g., default,ocean,galaxy). |
effect |
— | wave, glow |
Animation effect applied to all badges. |
column |
50 |
1-50 | Number of columns for badge grid layout. |
size |
small |
small, medium, large |
Badge size multiplier. |
p |
0 |
0-100 | Container padding in pixels around the badge grid. |
realtime |
false |
— | Bypass cache and fetch fresh data (30s cooldown). |
Fetch GitHub user statistics:
visitors— Unique visitor count (persisted per user)repositories— Total repositories countfollowers— Follower countorganization— Organizations countlanguages— Programming languages counttotal-stars— Stars received across all repostotal-contributors— Contributors count across all repostotal-commits— Total commits counttotal-code-reviews— Code reviews counttotal-issues— Issues counttotal-pull-requests— Pull requests counttotal-joined-years— Years since account creation
Fetch GitHub repository statistics:
stars— Repository stars countforks— Repository forks countcontributors— Repository contributors countissues— Open issues countpull-requests— Pull requests countwatchers— Repository watchers countsize— Repository size
/badges?username=pphatdev&name=visitors
/badges?username=pphatdev&name=visitors,total-stars,followers&theme=ocean&column=3&size=medium
/badges?username=pphatdev&repo=github-stats&name=stars,forks,contributors&theme=galaxy&effect=wave
/badges?username=pphatdev&name=visitors,repositories,followers&p=15&size=large&column=2
/badges?username=pphatdev&name=visitors,total-stars,repositories&theme=default,ocean,galaxy&column=1
/badges?username=pphatdev&name=total-stars&realtime=true
The API returns an SVG image with combined badges arranged in a grid layout. The response includes appropriate cache headers:
- Default cache: 10 minutes (
max-age=600) - Visitor badges: Updated on every request (counter incremented)
- Background refresh: Triggers after 15 seconds of staleness
- Rate-limit protection: 2-minute cooldown per cache key, 30-second cooldown per realtime request
- Badges are cached in-memory with 10-minute TTL
- Stale-While-Revalidate (SWR) pattern ensures fast responses with background refresh
- GitHub API calls are deduplicated to prevent rate-limit exhaustion
- Visitor counter increments on every request (database-backed, no API calls)
- Use
realtime=trueto bypass cache (subject to 30s cooldown per cache key)