Using a GitHub file as a database cause why not
I needed some type of like/clap counter for my blog. But then again, likes are lame. What I really needed was a beer 🍺 counter.
The problem is, I'm allergic to anything that resembles real backend work on a silly weekend project. So I used json file as a database, of course.
TL;DR

The backend
Our little Flask app backend exposes two endpoints — GET and POST /claps :
Each clap commits an updated claps.json to the repo.
Why this is a terrible idea, actually
GitHub's API has a rate limit of 5,000 requests per hour for authenticated requests. But it's not just claps burning through that budget — every page load does a GET to fetch the current count too.
- Page load = 1 request (
GETclaps.json) - Clap = 2 requests (
GETto read the currentsha+PUTto commit)
At a – very generous – 5% clap rate we've got roughly ~4,500 page loads per hour before GitHub starts bouncing. I don't know about you, but I am not getting these kinds of numbers just yet. 😊
The slightly bigger problem is the race condition. Every POST does read → increment → write. If two requests arrive simultaneously:
- Both read the same count and the same
sha - Both try to commit — GitHub will reject the second one with a 409 Conflict (SHA mismatch)
- That raises an unhandled exception → 500 error, clap is lost 😭
A real backend would use database operations. Oh well.
The frontend
The button is injected via Ghost's code injection. It finds the share bar, inserts itself right below it, and fetches the current count on load.
On click, it sends a POST, stores the clap in localStorage so the same browser can't clap twice (no cheating!) and shows a random first-clap message.

There's also a silly easter-egg when clicking again. Try it out at the end of this post. 👇(shameless)
The text also fades in and out via a CSS transition so that it doesn't just snap. That probably took me about 50 attempts to get right. I am not a web dev.
Anyways
Hope you found this somewhat useful.