This folder contains comprehensive guides on how to use each API route available in the GitHub Stats application.
- Core Statistics Routes - Main stats, languages, and graph visualization endpoints
- User Badge Routes - Personal GitHub statistics badges (visitors, repos, followers, etc.)
- Project Badge Routes - Repository-specific badges (stars, forks, issues, etc.)
- Cache Monitoring Guide - Health checks and cache statistics endpoints
- Development Guide - Local setup, environment variables, database, and run scripts
- Route Demo Index - One file per route with demo examples for each option
The GitHub Stats API provides multiple endpoints for:
- Statistics Rendering - Generate detailed stats cards and visualizations
- User Badges - Create individual badge components for specific metrics
- Project Badges - Repository-specific metric badges
- Cache Management - Monitor cache health and performance
http://localhost:3000 (default development)
All endpoints support optional styling parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
theme |
string | default |
Badge color theme (tokyo, dracula, nord, etc.) |
customLabel |
string | - | Custom label text for badges |
labelColor |
string | - | Custom color for label background |
iconColor |
string | - | Custom color for icons |
valueColor |
string | - | Custom color for values |
Most endpoints return SVG by default. Some support format conversion:
- SVG (default) -
?format=svg - WebP -
?format=webp - PNG -
?format=png(some routes only)
All endpoints include intelligent caching:
- Redis Persistent Cache - Survives server restarts (1min - 2hrs TTL)
- In-Memory Cache - Fast local caching layer (600-3600s TTL)
- Database Cache - SQLite persistence (2hr max)
- Requests are deduplicated at the service level
- Cache middleware handles request coalescing
- GitHub API calls are optimized to minimize quota usage
Most endpoints use the configured GitHub token for API calls. Some public endpoints may work without authentication with reduced rate limits.
curl "http://localhost:3000/stats?username=pphatdev&theme=tokyo"curl "http://localhost:3000/badge/followers?username=pphatdev&theme=dracula"curl "http://localhost:3000/project/stars?repo=pphatdev/github-stats"curl "http://localhost:3000/cache/health"All SVG responses can be embedded in:
- Markdown -
 - HTML -
<img src="proxy.php?url=https%3A%2F%2Fstats.pphat.top%2Fstats%3Fusername%3Dpphatdev" /> - README badges - Works great in GitHub profiles and project READMEs
If an endpoint returns an error:
- Check cache status:
/cache/health - Verify correct required parameters
- View cache statistics:
/cache/stats - Check that GitHub token is configured
- Ensure username/repo format is correct (owner/repo for projects)
For issues or feature requests, refer to the main project repository documentation.