Skip to content

πŸ‘€ Count the views of your Github profile with your own custom badge

License

Notifications You must be signed in to change notification settings

IgorKowalczyk/github-views

Repository files navigation

Github Profile Views


Note

Don't forget to replace example YOUR-USERNAME parameter with real value.

✨ Basic usage

  • Go to https://views.igorkowalczyk.dev and enter your Github username or any other text
  • Copy the generated markdown code with the style you like and paste it in your README.md file
![Github Views](https://views.igorkowalczyk.dev/api/badge/YOUR-USERNAME)

πŸ–ΌοΈ Available styles

Note

The default style is flat

Style Example Usage
flat style=flat
classic style=classic

Note

To apply the style, add to the URL ?style=YOUR-STYLE, if you use other parameters you can use &style=YOUR-STYLE

🎨 Custom colors

Note

The default color is blue

Color Example Usage Label Color Label usage
blue color=blue labelColor=blue
cyan color=cyan labelColor=cyan
green color=green labelColor=green
yellow color=yellow labelColor=yellow
orange color=orange labelColor=orange
red color=red labelColor=red
pink color=pink labelColor=pink
purple color=purple labelColor=purple
gray color=gray labelColor=gray
black color=black labelColor=black
ff69b4 color=ff69b4 labelColor=ff69b4

Note

To apply the style, add to the URL ?color=YOUR-COLOR, if you use other parameters you can use &color=YOUR-COLOR

Warning

HEX colors should be used without # symbol prefix.

πŸ“Š Number format

You can display the number of views in a more readable format. You can choose between short and long format.

Format Example Usage
short format=short
long format=long

Note

To apply the style, add to the URL ?format=YOUR-FORMAT, if you use other parameters you can use &format=YOUR-FORMAT

πŸ“ Custom text

You can overwrite default Views text with your own label.

![Github Views](https://views.igorkowalczyk.dev/api/badge/YOUR-USERNAME?label=Your+own+label)

Note

Replace whitespace with + character in multi-word labels.

πŸ“¦ JSON format

You can get the number of views in json format. It can be useful if you want to use the number of views in your application.

Warning

The API is read-only, you can't change the number of views.

Request:

https://views.igorkowalczyk.dev/api/json/YOUR-USERNAME

Note

Replace YOUR-USERNAME with your real value.

Response:

{ "views": 123 }

πŸ”© Local Development

  1. Clone this repository git clone https://github.com/IgorKowalczyk/github-views.git
  2. Run pnpm i to install all dependencies,
  3. Edit the wrangler.jsonc file with your values
  4. Run pnpm types to generate types for the project
  5. Run pnpm dev to start the development server or pnpm preview to preview the production build

πŸ–₯️ Hosting with Cloudflare Workers

  1. Clone this repository git clone https://github.com/IgorKowalczyk/github-views.git
  2. Run pnpm i to install all dependencies,
  3. Go to Cloudflare Workers and create a new project (you can import the project from GitHub)
  4. Go to Cloudflare > Storage & Databases -> KV -> Create, and create a new KV namespace
  5. Link the KV namespace to the project in the wrangler.jsonc file
  6. Edit the wrangler.jsonc file with your values
  7. Run pnpm types to generate types for the project
  8. Run pnpm dev to start the development server or pnpm preview to preview the production build
  9. If you want to deploy the project, run pnpm check to check the project and pnpm deploy to deploy the project to Cloudflare Workers

Note

Refer to the Cloudflare Workers documentation and Wrangler documentation for more information.

⁉️ Issues

If you come across any errors or have suggestions for improvements, please create a new issue here and describe it clearly.

πŸ“₯ Pull Requests

When submitting a pull request, please follow these steps:

  • Clone this repository https://github.com/IgorKowalczyk/github-views.git
  • Create a branch from main and give it a meaningful name (e.g. my-awesome-new-feature).
  • Open a pull request on GitHub and clearly describe the feature or fix you are proposing.

πŸ“‹ License

This project is licensed under the MIT. See the LICENSE file for details