@dytsou/github-readme-stats
v1.4.4
Published
Dynamically generate stats for your GitHub readme
Downloads
443
Maintainers
Readme
GitHub Readme Stats
Dynamically generated GitHub stats cards for your README.
Table of contents
- Quick Start
- User Cards
- Repository Cards
- Gist Card
- Deployment
- Configuration
- API Documentation
- Support
- Contributing
- Important Notes
Quick Start
- Deploy your instance — follow Deployment until you have a working Workers URL. Verify in a browser:
https://YOUR-INSTANCE.WORKERS.DEV/api?username=YOUR_USERNAME
2. Add this to your README (replace placeholders with your Workers hostname and GitHub username):
User Cards
Cards keyed by GitHub username.
GitHub Stats Card
Display your GitHub statistics including stars, commits, pull requests, and more.
Basic Usage
Examples
Use a theme:
Custom colors:
Responsive Themes
Use GitHub's theme context tags for automatic dark/light mode:
[](https://github.com/YOUR_USERNAME)
[](https://github.com/YOUR_USERNAME)See all available themes. All options: API.md — Stats Card.
Top Languages Card
Display your most frequently used programming languages.
Basic Usage
Examples
Compact layout:
Donut chart:
All options: API.md — Top Languages Card.
Streak Card
Display GitHub contribution streak statistics with current streak as the hero metric.
Basic Usage
Examples
Weekly streak mode:
Hide longest streak:
All options: API.md — Streak Card.
Heatmap Card
Render a GitHub-style contribution heatmap grid.
Basic Usage
Example
Custom cell colors:
All options: API.md — Heatmap Card.
WakaTime Card
Display your WakaTime coding statistics.
[!WARNING] Your WakaTime profile must be public. Enable both "Display code time publicly" and "Display languages, editors, os, categories publicly" in your WakaTime settings.
Basic Usage
Example
All options: API.md — WakaTime Card.
Repository Cards
Cards keyed by repository owner and name (username + repo).
Repository Card
Pin additional repositories beyond GitHub's 6-repo limit.
Basic Usage
Example
All options: API.md — Repository Card.
Sparkline Card
Render a cumulative commit history sparkline for one repository (like star history), using default-branch commits over the last N days (default 30).
Basic Usage
Example
All options: API.md — Sparkline Card.
Gist Card
Display GitHub Gists in your README.
Basic Usage
Example
All options: API.md — Gist Card.
Deployment
Prerequisites
- Node.js 22+ (matches this repo's
enginesfield) - GitHub Personal Access Token (PAT) — required. Set
GITHUB_PATas a Worker secret. Scope at GitHub token settings: public stats needread:user; private stats needrepo+read:user(see Important Notes).
Deploy to Cloudflare Workers
- Fork this repository
- Install dependencies:
pnpm install(install pnpm withnpm install -g pnpmif needed) - Configure:
node scripts/generate-wrangler-config.js— thenpnpm wrangler secret put GITHUB_PATfor production - Deploy:
pnpm run deploy— in Workers Builds, usepnpm run deploy(not barewrangler). SetGITHUB_PAT; optional GitHub Actions secrets:CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID - Use
https://YOUR-INSTANCE.WORKERS.DEVin your README embed URLs
Environment Variables
| Variable | Description |
| --------------- | ----------------------------------------------------------- |
| GITHUB_PAT | GitHub PAT (required); add GITHUB_PAT_2, … for more quota |
| WHITELIST | Comma-separated allowed usernames |
| CACHE_SECONDS | Default cache duration in seconds (0 disables) |
Full list: API.md — Environment Variables.
[!WARNING] Redeploy after changing environment variables.
[!IMPORTANT] For internet-reachable instances, set
WHITELISTto intended usernames. UnsetWHITELISTlets any username consume your GitHub quota. If you expose/api/gist, setGIST_WHITELISTto allowed gist IDs.
Use Sync Fork to pull upstream changes; redeploy and re-check secrets after syncing.
Configuration
Aligning Cards Side by Side
[](https://github.com/YOUR_USERNAME)
[](https://github.com/YOUR_USERNAME)Locales
Set locale= on any card URL (e.g. &locale=es). Supported codes: API.md — Supported Locales.
Caching
Each card type has default cache durations and per-card min/max clamps for cache_seconds; override globally with CACHE_SECONDS. Details: API.md — Cache Durations.
API Documentation
Full reference: API.md, hosted docs, or openapi.yaml.
Support
If something is not working:
- Confirm your Workers URL loads in a browser (see Quick Start)
- Check PAT scopes and private-stats caveats in Important Notes and Deployment
- For WakaTime cards, confirm profile visibility under WakaTime Card
- Open an issue with the failing URL (redact secrets)
When things go wrong
Card endpoints return error SVGs (not JSON) for most failures:
| What you see | Likely cause |
| ---------------------------------- | ----------------------------------------------------------------------------- |
| Missing username / parameter error | username (or repo, id) not in the URL |
| User not found | GitHub username typo or organization name used as username |
| Rate limit / downtime message | GitHub API quota exhausted — add GITHUB_PAT_2, tighten WHITELIST, or wait |
| No tokens / PAT message | GITHUB_PAT secret not set on the Worker |
| WakaTime user not found | WakaTime profile or visibility settings (see WakaTime Card) |
Full error shapes: API.md — Error Handling.
Contributing
Contributions welcome — star the repo, open issues, or send PRs.
Important Notes
[!IMPORTANT] This fork is self-host-only — deploy your own Cloudflare Workers instance; there is no shared public demo URL in this repo. The GitHub API allows 5k requests per hour per PAT. Caching reduces repeat GitHub API hits for the same card URL; it does not guarantee staying under the limit when many usernames are requested, caches expire, or
CACHE_SECONDSis0. SetWHITELISTto the usernames you intend to serve, and addGITHUB_PAT_2(and further) tokens if you need more quota.
[!WARNING] By default, cards only show statistics from public repositories. To include private repository statistics, deploy your own instance with a GitHub Personal Access Token that belongs to the same user as
username. Private-repo aggregates rendered this way are still served on the public card URL — treat that as intentional disclosure, restrict the instance withWHITELIST, and do not embed the URL where those totals should stay private. Organization or SSO-restricted private repos may remain invisible even with a PAT.
