Live SVG widgets for GitHub contribution stats. Embed auto-updating stats in your GitHub profile README or any Markdown surface.
Shows merged PR count, merge rate, repo count, current streak, and a 12-week sparkline.
[](https://github.com/YOUR_USERNAME)Shows your top 8 external repos (excluding your own) sorted by merged PR count in the last 12 months.
Shows your five most recently merged PRs with repo name and time-ago.
Shows a 26-week contribution heatmap with intensity-based coloring.
The badge shows merge rate, merged count, and open PR count. Only counts PRs to external repos with 50+ stars by default.
| Parameter | Values | Description |
|---|---|---|
theme |
light (default), dark |
Color scheme (card, recent, activity) |
cache |
no |
Bypass the 1-hour in-memory cache |
minStars |
number (default: 50) |
Minimum repo star count (badge only) |
For GitHub profile READMEs that respect the viewer's theme preference:
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://oss-widgets.vercel.app/api/card/YOUR_USERNAME?theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://oss-widgets.vercel.app/api/card/YOUR_USERNAME?theme=light" />
<img alt="OSS Stats" src="https://oss-widgets.vercel.app/api/card/YOUR_USERNAME?theme=dark" />
</picture>- CDN: 1 hour max-age + 10 min stale-while-revalidate (configured in
vercel.json) - In-memory: 1 hour TTL with 24-hour stale fallback
- Cache bypass: Append
?cache=noto any endpoint - Error responses: Badge errors are not cached at the CDN level (
no-cache, no-store)
Deploy your own instance to Vercel:
- Fork this repo
- Create a Vercel project linked to your fork
- Add a
GITHUB_TOKENenvironment variable — a classic PAT with no special scopes works (the GitHub Search API only needs public data access). Note:gh auth tokenOAuth tokens (gho_*) do not work from Vercel; use aghp_*PAT. - Deploy
pnpm install # Install dependencies
pnpm test # Run all tests (103 tests across 8 files)
pnpm run typecheck # TypeScript check
vercel dev # Local dev serverapi/
├── card/[username].ts # Stats card endpoint
├── recent/[username].ts # Recent contributions endpoint
├── activity/[username].ts # Activity graph endpoint
├── top-repos/[username].ts # Top contributed repos endpoint
└── badge/[username].ts # Shields.io badge endpoint (JSON, standalone)
lib/
├── endpoint-handler.ts # Shared handler factory (cache, timeout, error SVGs)
├── github-data.ts # GitHub API data fetching + types
├── svg-card.ts # Stats card SVG renderer
├── svg-top-repos.ts # Top contributed repos SVG renderer
├── svg-recent.ts # Recent contributions SVG renderer
├── svg-activity.ts # Activity graph SVG renderer
├── svg-utils.ts # Shared SVG utilities (themes, icons, escaping)
├── vercel-types.ts # Shared Vercel request/response shims
└── *.test.ts # Co-located tests
The card, recent, activity, and top-repos endpoints use the shared createWidgetHandler factory. The badge endpoint is standalone because it returns JSON (Shields.io format) rather than SVG.
MIT
Originally extracted from oss-autopilot.