Developers love badges. For these reason there are a ton of different Github Badges websites that let you build out your own badges for your projects. Most of them have the same issue though- they stop working quickly due to the Github API Ratelimiting, which only allows 60 requests each hour if you’re calling it directly from the browser.
I also love badges, and wanted them to work for my new portfolio page. The problem is that with almost forty projects I was hitting that ratelimit pretty hard, to the point where refreshing the page once was enough to do it.
So I made my own API, GitStars, which I am now sharing with all of you.
GitStars has a few features that make it nice for front end development-
- No Ratelimit- if a project has been loaded once it will always load again after.
- Smaller Responses as the service strips out data (such as URLs) that can be easily generated.
- Faster Responses due to caching- most responses come from SQLite rather than calling Github, returning responses in about 20ms.
- Higher Resilience, as it will return cached results when errors occur.
- Browser Caching, as various headers (such as Expires) are added. This speeds up page reloads significantly.
- Easy Migration since the service mirrors the Github API endpoints and responses. Changing “api.github.com” to “stars.gitconsensus.com” will work for most projects.
As part of this project I also launched gitbuttons.tedivm.com, which forks a popular github badges project and has it use this new API.