GitHub Stats Dashboard
A self-hosted dashboard that tracks GitHub repository statistics over time. Collects stars, forks, traffic, clones, and release download counts daily via the GitHub API and displays them with interactive charts.

Why?
GitHub only retains 14 days of traffic data. This dashboard collects it daily so you don't lose it, and gives you a single page to track trends across multiple repositories.
What You Get
- Stat cards: Stars, forks, visitors, views, cloners, clones, total downloads, open issues — with day-over-day deltas
- Charts: Stars over time, daily traffic, cumulative downloads, daily clones (all via Chart.js)
- Release table: Download counts per release, excluding checksums and metadata files
- Multi-repo support: Tab between repositories on a single dashboard
Requirements
- A Linux server (any cheap VPS works — this runs on a $5/month box)
- Python 3 (standard library only, no pip packages)
- Nginx (for serving static files + SSL)
- A GitHub fine-grained personal access token with:
- Metadata: Read-only
- Administration: Read-only (required for traffic/clones API)
- Scoped to the repositories you want to track
Setup
1. Create a GitHub PAT
Go to GitHub → Settings → Developer settings → Fine-grained tokens → Generate new token.
- Set repository access to "Only select repositories" and pick your repos
- Under Permissions → Repository permissions:
- Metadata: Read-only (selected by default)
- Administration: Read-only
Save the token.
2. Server setup
# Install nginx and certbot
sudo apt update && sudo apt install -y nginx certbot python3-certbot-nginx
# Save your GitHub token
echo "ghp_your_token_here" | sudo tee /etc/github-stats-token > /dev/null
sudo chmod 600 /etc/github-stats-token
# Create the web root
sudo mkdir -p /var/www/stats/data
# Copy the dashboard files
sudo cp index.html /var/www/stats/
sudo cp collect.py /opt/github-stats-collect.py
sudo chmod +x /opt/github-stats-collect.py
3. Configure the collector
Edit collect.py or create a config file:
sudo cp config.example.json /etc/github-stats.json
# Edit /etc/github-stats.json with your repos
Then run with:
python3 /opt/github-stats-collect.py --config /etc/github-stats.json
Or just edit the DEFAULT_CONFIG dict at the top of collect.py directly.
4. Configure nginx
sudo cp nginx.example.conf /etc/nginx/sites-available/stats.example.com
# Edit the server_name to your domain
sudo ln -s /etc/nginx/sites-available/stats.example.com /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default # optional
sudo nginx -t && sudo systemctl reload nginx
5. SSL
Point your domain's DNS A record to your server IP, then:
sudo certbot --nginx -d stats.example.com
6. Edit the dashboard
Open index.html and update the REPO_DISPLAY object to match your repos:
const REPO_DISPLAY = {
"my-project": { short: "MP", color: "#58a6ff" },
"other-project": { short: "OP", color: "#3fb950" },
};
The keys must match the repo names in your config (the part after the / in owner/repo).
7. Set up recurring collection
# Run hourly at :15 past the hour
(crontab -l 2>/dev/null; echo '15 * * * * /usr/bin/python3 /opt/github-stats-collect.py --config /etc/github-stats.json >> /var/log/github-stats.log 2>&1') | crontab -
# Or daily at 6:15 AM UTC if you prefer
# 15 6 * * * ...
8. Run the first collection
python3 /opt/github-stats-collect.py --config /etc/github-stats.json
Visit your domain — you should see the dashboard with data.
How It Works
The collector is a single Python file with zero dependencies (just urllib from the standard library). It hits the GitHub API for each repo, collects stats, and writes three JSON files:
| File |
Purpose |
data/YYYY-MM-DD.json |
Full daily snapshot (kept for history) |
data/history.json |
Rolling summary array — one entry per day, used by charts |
data/current.json |
Latest snapshot — used by the dashboard for stat cards and traffic |
The dashboard is a single static HTML file. No build step, no framework, no server-side code. It loads the JSON files with fetch() and renders everything client-side with Chart.js.
Notes
- Traffic data: GitHub only keeps 14 days. The collector preserves it in daily snapshots, but you can only capture what's available at collection time. Start collecting early.
- Download counts: These are all-time cumulative numbers from GitHub's release API. The collector stores the total at each snapshot; the dashboard plots the trend.
- Re-running: Safe to re-run the collector multiple times per day. It replaces the current day's entry in
history.json rather than duplicating it.
- No database: Everything is flat JSON files. Simple to back up, inspect, and debug.
License
MIT