Universal Badge Service is a stateless Node.js microservice that generates crisp, responsive SVG badges using the GitHub REST API.
Supported badge types:
stars: Stargazers countforks: Forks countissues: Open issues & PRs search countopen-issues: Repository open issues countprs: Open pull requests countcontributors: Contributor countcommits: Total commit countlast-commit: Date of the latest commit (YYYY-MM-DD)release: Latest release tag namewatchers: Repository watchers countlicense: Repository license (SPDX identifier or name)size: Repository size formatted (KB / MB)language: Primary repository language
Visual configuration:
label: Override the default badge labelcolor: Hex color code (e.g.ffd700,#ff5722) or CSS named color (blue,crimson, etc.)labelColor: Hex color or CSS named color for the left segment (default:#555)style:flat(default),flat-square,plastic,for-the-badgecacheSeconds: Custom HTTP Cache-Control max-age header (default:300)
- Uses
node:httpto minimize overhead and eliminate framework bloat. - SVG rendering uses
<clipPath>for clean, gapless rounded corners. - In-memory TTL cache reduces GitHub API requests and mitigates rate limiting.
- Supports CORS (
Access-Control-Allow-Origin: *),HEADrequests, and.svgURL extensions. - Strict TypeScript configuration enforced via tsconfig.json.
URI patterns:
/{owner}/{repo}/{type}/{owner}/{repo}/{type}.svg
Example Requests:
GET /TurboRx/CSS-Gradient-Generator/stars
GET /TurboRx/CSS-Gradient-Generator/license.svg?color=emerald&labelColor=333
GET /TurboRx/Universal-Badge-Service/watchers?style=for-the-badge
Run unit tests:
npm testDocker build:
docker build -t universal-badge-service .Docker run:
docker run --rm -p 3000:3000 -e GITHUB_TOKEN=... universal-badge-serviceLicensed under the MIT License. See LICENSE.