@shiinasaku/github-card
v5.1.0
Published
Beautiful GitHub stats SVG cards. Embed in README, use as API, or render programmatically.
Maintainers
Readme
Beautiful, blazing-fast GitHub profile cards
Live SVG cards for your README — stars, commits, languages, all auto-updating. One line, zero config, edge-cached.
Live instance · shiinasaku · theme shiina — updates itself as you code
✨ What's new in 4.2
System-font only · no shipped
.woff2· crisper text (geometricPrecision, tabular numbers) · new 24 px icons (MingCute / Huge / Tabler) · airy stat stack with 7 px gaps, no boxes · defaultaffiliations=owner— org stars excluded unless?affiliations=affiliated· fully typedgithub.ts&github-client, cache v9.
Quickstart
Paste into your profile README — replace shiinasaku with your username:
[](https://github.com/shiinasaku)That's it. No sign-up, no build — the card refreshes automatically as cached data expires.
Requires Bun 1.4.4 or newer. Add a GitHub token to .env for local API requests; the renderer library itself does not need a token. tsdown builds require Node.js 22.18+ (build time only); the package output targets Node.js 20.19+.
bun install
cp .env.example .env # add GITHUB_TOKEN
bun run dev:server # http://localhost:3000| Command | Action |
| ------------------- | ----------------------- |
| bun run dev | tsdown watch build |
| bun run build | tsdown production build |
| bun test | Run tests |
| bun run typecheck | Native bun check |
| bun run fmt | Bun native formatter |
| bun run fmt:check | Check formatting |
Formatting uses Bun's built-in bun fmt; no separate formatter or linter is installed.
Bun 1.4.4 does not provide a built-in bun lint command. bun check enforces strict typing and
unused-symbol checks. TypeScript is retained only to emit the library’s .d.ts files during builds.
The library bundle and .d.ts declarations are produced by tsdown from src/lib.ts into dist/. bun run dev:server runs the API locally; bun run dev watches the library build.
src/index.ts serves as the entrypoint for Vercel and local development, starting a listener
only when run directly. The rendering library is unchanged.
Why GitHub Card?
One line, zero config
An <img> tag is the entire integration. No OAuth, no action.
Edge-fast
L1 memory + L2 Redis SWR, s-maxage=1800, stale-while-revalidate, ETag/304. Warm hits render in microseconds.
Retina avatars Profile images inlined as Base64 at 2×, clipped + ringed in pure SVG.
Adaptive layout Width, wrapping, and legends measured with per-glyph metrics — nothing ever overlaps or clips.
Users and orgs
GET /card/:login works for users and organizations.
Glassmorphic depth Radial + linear ambient gradients track your accent for volumetric light at zero runtime cost.
OpenAPI docs live at /openapi. Pure ESM lib, zero server dep for renderCard.
Themes — 21 hand-tuned
Preview every theme with your own data:
| Dark favorites | Light & accent |
| -------------------------------------------------- | ------------------------------------------------ |
| shiina · aurora · oled · slate | default · pearl · sand |
| github_dark · dark · nord · dracula | forest · rose · cobalt |
| tokyonight · synthwave · radical · monokai | gruvbox · merko · onedark · highcontrast |
Add ?theme=tokyonight or override any slot with hex or Tailwind tokens: pink-400, #ff79c6, ff79c6.
Customization
| Parameter | Type | Description |
| -------------- | :--------: | ----------------------------------------------------------------- |
| theme | string | Built-in theme (table above) |
| bg_color | string | Background fill |
| title_color | string | Name / title |
| text_color | string | Stats, labels, body |
| icon_color | string | Icons + ambient glow |
| border_color | string | Card outline |
| hide_border | boolean | Remove outline |
| compact | boolean | Slim — hides bio/pronouns/Twitter/legend |
| animate | boolean | Fade-in stats + animated language bar |
| hide | string[] | Hide stats: stars, commits, issues, repos, prs |
| hide_langs | string[] | Exclude hide_langs=html,css |
| show_langs | string[] | Only show_langs=typescript,rust |
| lang_count | 1–10 | Top languages (default 5) |
| scope | string | personal (default), org, all |
| orgs | string[] | Restrict org stats to orgs=vercel,elysiajs |
| affiliations | string | owner (default) or affiliated — org stars excluded by default |
| fields | string[] | Fetch only fields=stats for speed |
What the numbers mean
- Stars, repositories, and languages come from non-fork repositories in the requested scope.
affiliations=owneris the default for both the HTTP API andgetProfileData. - User commits are contributions credited by GitHub from January 1 (UTC) to now, not lifetime
commit counts. Default user PR/issue totals are lifetime authored totals. With
scope=org, commits, PRs, and issues are this year's contributions to the selected organizations. scope=allcombines personal and contributed organization repositories without counting a repo twice; its activity totals remain the user's totals.orgsfilters the organization portion.- Organization accounts have repository/star/language data, but no computed activity totals.
Those metrics display
—(and arenullinUserStats), not a misleading zero. - Language filters run before
lang_count. Percentages describe the displayed languages by code size, not time spent coding. The bar and legend use the same “Other” group. - Results depend on what the GitHub token can access. GitHub's query limits still apply: the top 10 languages per repository and up to 100 repositories in each org contribution breakdown. Repository pagination supports up to 10,000 repos per connection; reaching that limit with more pages remaining returns an error rather than caching incomplete totals.
Examples
<!-- Dracula, no border, animated -->

<!-- Fully custom colors -->

<!-- Compact, no issues/prs -->

<!-- Include org stars explicitly -->

<!-- Organization -->
Deploy your own
- Click the button (or fork + import).
- Add env vars:
| Variable | Required | Purpose |
| :------------: | :------: | ----------------------------------- |
| GITHUB_TOKEN | ✅ | GitHub PAT — read-only is enough |
| REDIS_URL | ➖ | Redis / Upstash for shared L2 cache |
- Done — serves
/card/:usernameon Vercel CDNs-maxage=1800, stale-while-revalidate=1800.
Without Redis, bounded in-memory cache (1000 entries, SWR 30 min) still keeps warm instances fast.
API
| Endpoint | Description |
| ----------------------- | ------------------------------------------- |
| GET /card/:username | SVG card — all params above |
| GET /:username/themes | One SVG with all themes for a user |
| GET /meta | Service metadata + theme list |
| GET /health | Uptime, cache telemetry, Redis reachability |
| GET /openapi | Interactive OpenAPI docs |
Responses: image/svg+xml, ETag + CDN-Cache-Control + CORS *. Conditional If-None-Match → 304.
Use as a library
bun add @shiinasaku/github-card # Bun
npm install @shiinasaku/github-card # Node / Next / Viteimport { renderCard, themes } from "@shiinasaku/github-card";
const svg = renderCard(user, stats, languages, { theme: "tokyonight" });
// → SVG string, no network or server requiredPrebuilt dist/lib.js + .d.ts; Bun resolves raw TS via bun export condition. Pure renderer — no network, no server.
Architecture
flowchart LR
A[GET /card/:username] --> B[Elysia<br/>validation · CORS · OpenAPI · timing]
B --> C{L1 memory<br/>SWR 30m}
C -- hit --> G[render SVG<br/>ETag/304 → CDN]
C -- miss --> D{L2 Redis<br/>SWR 30m}
D -- hit --> G
D -- miss --> E[GitHub GraphQL<br/>100/page, up to 100 pages, 6s/request]
E --> F[typed fetch<br/>+ avatar 150px]
F --> G
G --> H[Pure SVG<br/>system fonts · measured layout · glass]- Bun + Elysia — one of the fastest HTTP stacks.
- Two-tier SWR — stale served instantly + background refresh, request coalescing via
inFlight. - Typed upstream —
RepoNode/ContributionEntrygenerics,T=unknown,TimeoutError/RateLimitErrormapping.
Releasing
Automated through staging; the npm publish needs one maintainer approval:
- Actions → Bump →
patch/minor/major/prerelease. - Workflow bumps
package.json, commits, tagsvX.Y.Z, then dispatches Release. - Release verifies the tag/version, runs formatting, typecheck, tests, build, and
npm pack --dry-run, then stages the package on npm with provenance and creates the GitHub Release. - Approve the staged package on npmjs.com (or
npm stage approve <id>) to make it installable.
MIT © saku shiina — built with Bun, Elysia, and system fonts.
Stars default to owner only in 4.2 — add ?affiliations=affiliated to include orgs.
