Show your GitHub stats in badges
Inspired by git-badges and serverless-github-badges but implemented in Golang
Number of visitors the user had, recorded in a MongoDB database and updated on every GET request
https://badges.temir.dev/visits?username={username}&repo={repo}&style=for-the-badge&logo=github&color=yellow
[![Visits Badge](https://badges.temir.dev/visits?username={username}&repo={repo}&style=for-the-badge&logo=github&color=yellow)](https://badges.temir.dev/visits?username={username}&repo={repo}&style=for-the-badge&logo=github&color=yellow)
Number of organizations the user is a part of
https://badges.temir.dev/organizations?username={username}&style=for-the-badge&logo=github&color=yellow
[![Organizations Badge](https://badges.temir.dev/organizations?username={username}&style=for-the-badge&logo=github&color=yellow)](https://badges.temir.dev/organizations?username=dtemir&style=for-the-badge&logo=github&color=yellow)
Number of years the user has been registered at GitHub
https://badges.temir.dev/years?username={username}&style=for-the-badge&logo=github&color=yellow
[![Years Badge](https://badges.temir.dev/years?username={username}&style=for-the-badge&logo=github&color=yellow)](https://badges.temir.dev/years?username=dtemir&style=for-the-badge&logo=github&color=yellow)
Number of public repositories the user owns
https://badges.temir.dev/repos?username={username}&style=for-the-badge&logo=github&color=yellow
[![Repos Badge](https://badges.temir.dev/repos?username={username}&style=for-the-badge&logo=github&color=yellow)](https://badges.temir.dev/repos?username=dtemir&style=for-the-badge&logo=github&color=yellow)
If you would like to deploy it yourself, please follow these steps:
- Install Go
- Install MongoDB Community
- Download dependencies with
go mod download
- Create a
.env
file with a GitHub token (look at.env.example
) - Run with
go run *.go
- Install Docker Engine with the Compose plugin
- Create a
.env
file with a GitHub token (look at.env.example
) - Build an image with
docker compose up
(add-d
if you want to run it in the background)
Don't forget to run tests go test
to make sure everything works correctly!
- To avoid having to send all requests to port 8080, you want to setup a reverse proxy that will forward traffic through port 80 (the default port when accessing websites)
- If this wasn't setup, you would have to access the website through
badges.temir.dev:8080
instead of regularbadges.temir.dev
- If this wasn't setup, you would have to access the website through
- To avoid using HTTP and use secure HTTPS instead, you want to receive an SSL certificate with Let's Encrypt, which is automatable with
certbot
- If this wasn't setup, you would have to make requests to
http://badges.temir.dev
instead ofhttps://badges.temir.dev
and it would cause problems with common browsers
- If this wasn't setup, you would have to make requests to
Find how to accomplish both of these things in this article: here
To make sure this project is properly maintained, I used GitHub workflows to test and automatically deploy to Oracle Cloud Micro Instance that comes with Always Free Tier
You can find workflows under Actions
- check_build.yml to make sure Go compiles
- check_compose.yml to make sure docker-compose.yml is up-to-date
- deploy.yml to deploy the latest changes to Oracle Cloud