Self-Deployed GitHub Stats
Self-Deployed GitHub Stats
After creating the Dynamic GitHub Profile in the previous post, I noticed that my profile widgets were broken the next morning. Very strange, but I looked into the repo’s issues and discovered that this can happen when the host’s Vercel instance that is running the stats tracker gets rate limited from getting more uncached requests than their GitHub Personal Access Tokens can allow.
To be clear, the downtime is only for an hour, but if you want to be sure that a potential employer can see your profile in its full glory, that could be a problem.
Luckily, there is an easy fix. The project is open-source, and it is very easy to host our own free Vercel instance running the stats tracker with our own GitHub Personal Access Token.
Table of Contents
Fork the GitHub Stats repository
Navigate to https://github.com/anuraghazra/github-readme-stats and click the fork
button at the top right to create
a fork that you can use for the Vercel instance.
*** If you choose the free Vercel tier, make sure that the maxDuration
flag in vercel.json
is set to 10.
Create a new GitHub Personal Access Token
- Navigate to the personal access tokens page
- This can be found by going to settings > Developer Settings > Personal Access Tokens or by this link.
- Click
Generate a new token
- It does NOT need any permissions to function, so do not select any
- Copy the generated token
Create Vercel instance
- Navigate to https://vercel.com/
- Create a new account with your GitHub account
- Select Hobby (unless you want to pay for Pro for other projects)
- Click
Create a new project
- Install to your GitHub account and select
Only select repositories
- Select the
github-readme-stats
fork you made - Click install
- Click
Import
on the GitHub repo that you just added to the project - Add the Personal Access Token as an Environment Variable
- Name the variable
PAT_1
- Paste the personal access token you generated as the value
- Click
Add
- Name the variable
- Click
Deploy
Update the GitHub profile README template
- Click
Continue to dashboard
once the Vercel app has been successfully deployed - Copy the domain provided
- Replace the original stats domain with the one we just deployed
- Originally it was
github-readme-stats.vercel.app
- Replace only this portion with your new app’s domain for both of the widgets
- Originally it was
- Push the updated template to GitHub
That’s all there is to it. They have made it super easy to get it set up and running on your own free deployment. This should fix any potential issues with downtime on your profile widgets.