GitHub Stargazers Tracker

A Go application built with Cobra CLI that tracks stargazers for your GitHub repositories over time. It helps you monitor the growth and changes in your repository's stargazers.
Features
- Track stargazers for all your GitHub repositories
- Store historical stargazer data in SQLite database
- Identify new and lost stargazers between runs
- Simple configuration with environment variables
- Lightweight and fast execution
- Modern CLI interface with subcommands
- Easy to extend with new commands
Prerequisites
- Go 1.25 or higher
- GitHub Personal Access Token with
public_repo scope
- Git
Installation
From Source
-
Clone the repository:
git clone https://github.com/dbunt1tled/github-stargazers.git
cd github-stargazers
-
Build the application:
go build -o github-stargazers ./cmd/main.go
Using Go Install
go install github.com/dbunt1tled/github-stargazers/cmd/github-stargazers@latest
Configuration
-
Copy the example environment file:
cp .env.example .env
-
Edit the .env file with your GitHub credentials:
GITHUB_USERNAME="your-github-username"
GITHUB_TOKEN="your-github-token"
DATABASE_PATH="./data.db"
Available Commands
Track Stargazers
Fetch and track stargazers for all your repositories:
./github-stargazers stargazers
This command will:
- Fetch all repositories for the specified GitHub user
- Get current stargazers for each repository
- Store the data in the SQLite database
- Show new and lost stargazers compared to the previous run
List Unstarred Users
List users who have unstarred your repositories:
./github-stargazers unstar
Help
Get help about any command:
./github-stargazers help
Or for a specific command:
./github-stargazers help stargazers
./github-stargazers help unstar
Project Structure
.
├── cmd/
│ └── main.go # Main application entry point
├── internal/
│ ├── cli/ # CLI command implementations using Cobra
│ │ ├── root.go # Root command and command setup
│ │ ├── stat.go # Stargazers statistics command
│ │ └── unstargazer.go # Unstargazer tracking command
│ ├── config/ # Configuration management
│ ├── db/ # Database operations
│ └── github/ # GitHub API client
├── .env.example # Example environment variables
├── go.mod # Go module definition
└── go.sum # Go module checksums
Building and Running
Build
go build -o github-stargazers ./cmd/main.go
Run
./github-stargazers
Run with custom config
GITHUB_USERNAME=your-username GITHUB_TOKEN=your-token ./github-stargazers
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments