FastAPI service that generates SVG badges showing total star counts for GitHub organizations.
- Fetches star counts across all repos in a GitHub organization
- Generates SVG badges using PyBadges (compatible with shields.io style)
- Fast responses with 1-hour caching (TTLCache)
- GraphQL API for efficient fetching (100 repos per query)
- Automatic REST API fallback if GraphQL fails
- JSON API endpoint for programmatic access
- API: FastAPI with async/await and thread pool execution
- GitHub API: GraphQL primary, REST fallback via PyGithub
- Caching: TTLCache (1 hour TTL, 1000 item max)
- Performance: Async execution with 10s timeout, supports GitHub token for higher rate limits
- FastAPI, Uvicorn
- PyGithub, httpx (GraphQL)
- PyBadges, cachetools
- Install deps:
pip install -r requirements.txt - (Optional) Set
GITHUB_TOKENenv var for higher rate limits - Run:
uvicorn main:app --reload - Test:
pytest
Note: Without a GitHub token, you're limited to 60 requests/hour. With a token, you get 5,000 requests/hour.