README Stats
- Date
- Author
NINikki Sophie 🌸- Stack
- TypeScript, Bun, GitHub GraphQL API, SVG, fontkit, SQLite, Docker
- Tags
- Back-EndSelf-Hosted
Pictures
Every card on my GitHub profile, drawn in one matching style by one small Bun server on my home server. My profile used to need three services to say one thing: stats came from one, the streak from another, the top languages from a third, and each had its own fonts, its own theme options and its own idea of how big a card is. They never quite lined up, and when one of them went down, the middle of my profile was a broken image.
Now one server draws every card on my profile, in one style, in a dark and a light version:
- a profile card with commits, pull requests, issues, stars and repositories, the current and longest streak, the top languages as a bar and the last year of contributions as a graph, one picture where I used to need three
- project cards with a repository's name, description, language, stars and forks, to show more projects than GitHub's six pins
- a skills grid with a row of logos per group
- badges for my socials and a banner for the top of the README
- a view counter, which can say since when it counts and start from a count carried over from another counter
Everything is in the link
Each card is one link, and the link says everything about it. ?languages=typescript,java&frontend=react draws a skills grid with two rows: every query key is a group. It knows every Simple Icons logo, plus a few Simple Icons no longer has: Illustrator and Photoshop, and VS Code, whose logo I drew by hand.
Because one style is only mine, the link can change that too:
| In the link | What changes |
|---|---|
font= | Any family on Google Fonts, proportional ones included. JetBrains Mono when left out. |
bg= text= muted= accent= border= | The colours. The ones nobody names, like the graph's greens or purples, are mixed from these, and a dark background on its own gets light text. |
| four or eight hex digits | A see-through colour. |
radius= padding= border=false dividers=false | The shape: corners, room inside, no outline, no lines. |
title-size= label-size= text-size= | Text from xs to xl. Bigger text makes the card taller instead of running into what's under it. |
grid=false glow=false | The banner without its grid or glow. |
theme= | The dark or the light version. |
On a see-through background, the mixed colours (the dividers, muted text, graph and chips) are see-through by as much, so the card looks right on whatever page is behind it.

In a README, <picture> holds both links and shows the one that matches the reader's GitHub theme.
What happens when GitHub opens a link
GitHub never shows a card straight from my server. It copies every image in a README through its own proxy, so the proxy is the one asking. Here is what that request goes through.
Is it one of mine? Cards are only drawn for the accounts in the server's settings, so nobody else spends my GitHub token's limits.
Does it have to wait for GitHub? Almost never. GitHub's answers are kept in memory and fetched again in the background once they're 30 minutes old, so only the very first request ever waits. If GitHub doesn't answer, the last good answer keeps being shown. The streak and contribution total come from one GraphQL query with an alias for each year since the account was made, because GitHub only gives contributions a year at a time.
Which font? An image can't load fonts from anywhere else, so each card carries its own, cut down to Latin, as base64, with only the weights it uses. A Google Fonts family is fetched the first time it's asked for and kept on disk.
Where does the text go? Every width is measured from the font's own glyphs with fontkit, so a name is cut off, a description wrapped and a chip sized the same way in a pixel font as in a serif. Then each piece of text is placed as a chain of gaps, each one growing with the text or padding it belongs to and with how tall the font's capitals are. At the default sizes, the chain adds up to exactly the card as I designed it.
What if something goes wrong? The error is a picture too. A README shows a small "GitHub is not answering" chip, never a broken icon.
How long can GitHub keep it? The proxy passes the card's cache headers on to the browser, so each card says how long it's good for and carries an ETag. When I change a card's look, a v= that does nothing gives it a new link the proxy has never seen.
All of that is one process with two dependencies: Bun.serve routes, Simple Icons for the logos, fontkit for measuring and Bun's built-in SQLite for the view counter, in a Docker container.
One more thing a picture can't do is speak. So /stats.json gives the profile card's numbers as text, and a daily GitHub Action in my profile repository writes them into the card's alt text. A screen reader hears what the card shows.
Nobody has to write the links
All those options make for long links, so the server's own page at / builds them. It shows every kind of card with an Edit button, and a gallery of looks made only from links, which open in the builder too.

In the builder, you pick a card, change its options and see it straight away, in the dark or the light version. The preview is the card's real link, so what it shows is exactly what a README will. Ten presets give a starting point, and Random makes up a font, corners and a palette in one hue for both themes.

A switch gives every colour a dark and a light version, and each set goes into its own link of the snippet. The snippet is the whole <picture>, ready to paste, or just the link, with a copy button. The address keeps the card being built, so it can be bookmarked or sent, and opening it loads the card back into the builder.

The page has no framework: plain HTML, CSS and JavaScript, served by the same process as the cards.
Your own copy
Mine only draws my cards. The README walks through hosting a copy step by step: a GitHub token, a .env file and docker compose up. The builder comes with it.





