GithubHelp home page GithubHelp logo

github-counter's Introduction

GitHub views counter

Better than other views counter, this one checks the IP address of the visitor and counts only one view per IP address on 48 hours.

Why?

  • The other views counter don't have customization options.
  • They count the views of the same visitor multiple times causing the number to be inflated.
  • They are hosted on a third party which is not good for privacy and they can be down.

How to use

Host this script on a cloud server or on your own server with yarn start:prod.

You can use Heroku or other cloud service to host this script.

You have to create a Postgres database and a redis instance.

Add the environment variables DATABASE_URL, PORT and REDIS_TLS_URL to your environment.

You can use PRIVATE_USERNAME to host only for your personal use. Example: PRIVATE_USERNAME=your_username and then https://your-server-domain.com/count/your_username

Then take the endpoint and add it to your GitHub profile README.md file.

![](https://your-server-domain.com/count/your-username)

How to customize

  • Make your art on a vector editor like Inkscape

  • On counter text, use {count} to display the views count.

  • On profile text, use {profile} to display the profile name.

Note: You can't convert the text to path on Inkscape, you have to keep it as text.

Note: You can use both {count} and {profile} on the same text.

  • Then, save the art as a SVG file on src/templates folder.

  • Then, use the template query parameter with the name of the SVG file to use it.

![](https://your-server-domain.com/count/your-username?template=your-template.svg)

Questions

  • Why I have to host this app myself?

    Because I don't want to have the responsibility of the data and privacy of the users and I don't want to pay for the hosting for everyone using this app.

  • Why svg?

    Because it's easy to use an vector editor to customize the svg file.

  • Why redis?

    To check the IP address of the visitor and count only one view per IP address on 48 hours.

How to contribute

  • Fork the repo
  • Create a new branch
  • Make your changes
  • Check the code with yarn lint
  • Create a pull request

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.