Skip to content

About

Dynamic Fancy Github Stats Card Generator for your profile readme or any repo

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

github-stats

A GitHub profile stats card that can also count your visitors — without naming them. Your streak, contributions, repositories, followers and top languages come from the GitHub public API at render time. The only thing ever stored is the count itself.

Default card

Live generator: https://nishadnyc-github-stats.vercel.app — build your card visually and copy the markdown for your profile README.

Examples

These are static snapshots made with the project's own generator, so reading this README never triggers a count. Your live card updates itself.

Large, purple accent — ?size=lg&accent=#8b00d6

Large card

Small — ?size=sm (single column, every row still shown)

Small card

Light theme — ?bg=#f6f8fa&text=#1f2328&accent=#0969da&border=#d0d7de&glow=#0969da&streak=#cf222e

Light card

Custom avatar — ?img=<link to an image> replaces your GitHub avatar on the card (links only; if the link fails, your GitHub avatar is used instead)

Custom avatar card

How visitor counting works

In simple words:

  • Your card is an image. Every time someone opens your profile, the image is loaded from your server — so your server sees each load.
  • The counts live in a secret Gist: one tiny JSON file holding three values — {"date": "2026-11-28", "today": 12, "lifetime": 12}. It never grows.
  • Each time your card loads, the server reads the gist, adds one, and writes it back. That is the whole trick.
  • Only counts are stored. No IP addresses, no names, nothing about who visited — there is nothing to leak.
  • A card rendered for any other username is stats-only and never touches your counter.
  • Counting is optional. With no gist configured you get a clean stats-only card (self-hosting without a gist falls back to a local counter file).

Set up counting (5 minutes)

  1. Create a secret Gist. Go to https://gist.github.com, name the file counter.json, put {} as the content, and create it as a secret gist. Copy the gist ID from its URL — the long hex string.
  2. Create a token — it must be a classic token. GitHub Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token. Tick only the gist scope, and set no expiry (an expired token silently stops the counting). ⚠️ Fine-grained tokens cannot write gists at all — with one, the counter can read but never save. Classic is not optional here.
  3. Set two environment variables wherever you host: GIST_ID and GH_TOKEN.
  4. Embed your card in your profile README. Done — loads of your card now count.

Deploy your own

You publish the code, not a shared service — every instance runs with its own gist and its own token.

  • Vercel: import this project, add the env vars in Project Settings → Environment Variables, deploy. No build command is needed. vercel.json already declares "framework": "python"; if you set the project up by hand, the Framework Preset must be Python — with "Other" the card function is never built.
  • Docker: docker compose up -d with the same env vars. Serves on port 8095.
  • Local: cp .env.example .env, fill it in, then python3 app.py.

Environment variables

Variable What it does
OWNER_USERNAME Whose card counts visitors (the instance owner)
GIST_ID The secret gist that stores the counts (optional)
GH_TOKEN Classic token with the gist scope (optional)
TZ_NAME Timezone for the day boundary (default America/New_York)
PORT Listen port (default 8095)
COUNTER_FILE Local counter store when no gist is set (default data/counter.json)

URL parameters

Parameter What it does
username Render someone else's card (stats only, never counted)
size sm, md (default) or lg
accent, bg, text, border, glow, streak Hex colours, e.g. accent=#8b00d6
theme A full theme as URL-encoded JSON
tagline The line under your username (| Since <year> is added automatically)
hide Comma list of rows to hide: streak, longest, contributions, repos, followers, languages, visitors_today, visitors_lifetime
img Link to a custom avatar image (links only, no data: URIs)
count=0 Render without counting (the generator preview uses this)

Good to know

  • GitHub serves README images through its Camo proxy, which caches. The number shown on your profile can lag the real count, and a cached view does not count until Camo fetches again. The count underneath stays exact.
  • Each counted load costs one gist read and one gist write — far inside GitHub's API limits at any realistic profile traffic.
  • Stats are cached for 10 minutes. The counter is never cached.
  • No dependencies: Python 3 standard library only.

Developed with ❤️ by Nishad

About

Dynamic Fancy Github Stats Card Generator for your profile readme or any repo

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages