Giter Club home page Giter Club logo

git-badges-golang's Introduction

git-badges-golang

git-badges-golang

Show your GitHub stats in badges

Inspired by git-badges and serverless-github-badges but implemented in Golang

Features

Visits

Visits Badge

Number of visitors the user had, recorded in a MongoDB database and updated on every GET request

Endpoint

https://badges.temir.dev/visits?username={username}&repo={repo}&style=for-the-badge&logo=github&color=yellow

Markdown

[![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)

Organizations

Organizations Badge

Number of organizations the user is a part of

Endpoint

https://badges.temir.dev/organizations?username={username}&style=for-the-badge&logo=github&color=yellow

Markdown

[![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)

Reference

GitHub's API


Years

Years Badge

Number of years the user has been registered at GitHub

Endpoint

https://badges.temir.dev/years?username={username}&style=for-the-badge&logo=github&color=yellow

Markdown

[![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)

Reference

GitHub's API


Repos

Repos Badge

Number of public repositories the user owns

Endpoint

https://badges.temir.dev/repos?username={username}&style=for-the-badge&logo=github&color=yellow

Markdown

[![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)

Reference

GitHub's API


Deploy

If you would like to deploy it yourself, please follow these steps:

Manually

  1. Install Go
  2. Install MongoDB Community
  3. Download dependencies with go mod download
  4. Create a .env file with a GitHub token (look at .env.example)
  5. Run with go run *.go

Docker (Recommended)

  1. Install Docker Engine with the Compose plugin
  2. Create a .env file with a GitHub token (look at .env.example)
  3. 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!

Reverse Proxy and SSL/TLS

  • 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 regular badges.temir.dev
  • 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 of https://badges.temir.dev and it would cause problems with common browsers

Find how to accomplish both of these things in this article: here

CI/CD

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

  1. check_build.yml to make sure Go compiles
  2. check_compose.yml to make sure docker-compose.yml is up-to-date
  3. deploy.yml to deploy the latest changes to Oracle Cloud

git-badges-golang's People

Contributors

dtemir avatar

Stargazers

Iss M avatar luxu. avatar Alessandro Gambin da Silva avatar Song Liu avatar zakaria chahboun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.