Back to services

ghstats

Dashboard for tracking GitHub repos traffic history longer than 14 days.

View alternatives to ghstats
Suggest edit
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

ghstats is an open-source, self-hosted tool for tracking traffic to your GitHub repositories. The official repository describes it as: long-term historical data, SQLite storage, and a very small Docker image.

GitHub's built-in Traffic page only shows views and clone data for the last 14 days, and anything older is gone. ghstats periodically pulls this data through the GitHub API and stores it locally, so open-source authors and maintainers can see how their project's traffic has changed from the past to the present.

Key Features

  • Long-term traffic history: Continuously collects and stores your repositories' views and clones, getting around GitHub's 14-day retention limit.
  • Multi-repository overview: A single dashboard shows data for multiple repositories under your account, such as stars, forks, and traffic trends.
  • Referrers and popular content: Records referrers and popular paths, helping you understand where people discover your project.
  • SQLite storage: Data is kept in a single SQLite file, so there's no need to deploy a separate database, and backup and migration are easy.
  • Lightweight deployment: Provides a very small Docker image with low resource usage, so it runs on a personal server, a NAS, or a small VPS.

Target Users

  • Open-source authors and maintainers who want to track their project's popularity over the long term
  • Teams or organizations that need a unified view of data across multiple repositories
  • Developers who prefer to keep their data in their own hands and are willing to self-host

Deployment

ghstats is mainly deployed with Docker. The basic steps are:

  1. Create a Personal Access Token on GitHub that can read repository traffic data.
  2. When running the Docker container, pass in the token through an environment variable and mount a volume to store the SQLite database file.
  3. Open the port exposed by the container in your browser to see the statistics dashboard.

For the exact environment variable names, ports, and optional settings (for example, filtering which repositories to track), refer to the README in the official repository.

Technical Requirements

  • An environment that can run Docker
  • A GitHub token with permission to read traffic data for the target repositories
  • A small amount of disk space to store the SQLite data file

Notable Characteristics

  • GitHub itself doesn't provide long-term traffic data, so ghstats can only build up history starting from the day you deploy it. Data older than 14 days from before deployment can't be recovered.
  • All data is stored on your own server, with no reliance on third-party SaaS analytics services.
  • The project has a simple structure and low maintenance cost, making it well suited to running in the background for the long haul.