A simple and elegant web application to track and analyze traffic metrics for your GitHub repositories.
GitHub Traffic Analytics is a web-based dashboard that helps you monitor and analyze traffic patterns for your GitHub repositories. Authenticate with your GitHub account to view real-time traffic data, clone statistics, referrer sources, and popular paths across all your repositories.
- GitHub Authentication: Secure sign-in via GitHub OAuth
- Repository List: Browse and filter all your accessible repositories
- Traffic Dashboard: View detailed traffic analytics for individual repositories including:
- Views and unique visitor counts
- Clone and unique clone statistics
- Top referrer sources
- Popular pages/paths
- Historical data visualizations (last 14 days)
- Aggregated Traffic: Overview of total traffic across all your repositories
- Clean UI: Modern, responsive interface built with Tailwind CSS and Shadcn UI components
src/
├── app/
│ ├── api/
│ │ ├── auth/[...nextauth]/ # NextAuth authentication
│ │ ├── repositories/ # Repository listing API
│ │ └── traffic/ # Traffic data API
│ ├── repositories/ # Repositories list page
│ ├── traffic/ # Aggregated traffic dashboard
│ └── page.tsx # Home page with sign-in
├── components/
│ ├── RepositorySelector.tsx # Repository selection UI
│ ├── TrafficDashboard.tsx # Individual repo traffic display
│ ├── SessionProvider.tsx # Auth session provider
│ └── ui/ # Shadcn UI components
├── lib/
│ ├── auth.ts # NextAuth configuration
│ ├── github.ts # GitHub API service
│ └── utils.ts # Utility functions
└── types/
└── next-auth.d.ts # NextAuth type definitions
- Node.js 18+ and npm/pnpm
- GitHub account
- GitHub OAuth application credentials
-
Clone the repository
git clone https://github.com/aliammari1/github-traffic-analytics.git cd github-traffic-analytics -
Install dependencies
pnpm install # or npm install -
Set up environment variables Create a
.env.localfile with:GITHUB_ID=your_github_oauth_app_id GITHUB_SECRET=your_github_oauth_app_secret NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your_secret_key -
Run the development server
pnpm dev
Open http://localhost:3000 in your browser.
- Framework: Next.js 16 with App Router
- Language: TypeScript
- UI Components: Shadcn UI
- Styling: Tailwind CSS 4
- Authentication: NextAuth.js
- API Client: Octokit (GitHub REST API)
- Charts: Recharts
- Animation: Framer Motion
- Icons: Lucide React, Tabler Icons
- Click "Sign in with GitHub" on the home page
- Authorize the application to access your GitHub data
- You'll be redirected to the app dashboard
- Navigate to Repositories to see all your repositories
- Click on a repository to view its detailed traffic statistics
- View traffic data including:
- Total views and unique visitors
- Clone statistics
- Top referrer sources
- Popular pages/paths
- 14-day historical data
- Navigate to Traffic to see aggregated metrics across all repositories
- View total views, clones, and stars across your account
- See a combined traffic chart over the last 14 days
- Home (
/): Authentication and introduction - Repositories (
/repositories): List and browse your repositories - Traffic (
/traffic): Aggregated traffic analytics across all repos
POST /api/auth/[...nextauth]/- NextAuth authenticationGET /api/repositories- Fetch user's repositoriesGET /api/traffic- Fetch traffic data for a specific repository
| Variable | Description | Example |
|---|---|---|
GITHUB_ID |
GitHub OAuth App ID | abc123def456 |
GITHUB_SECRET |
GitHub OAuth App Secret | secret_key_here |
NEXTAUTH_URL |
Application URL | http://localhost:3000 |
NEXTAUTH_SECRET |
Secret for NextAuth | random_secret_string |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub - For the powerful GitHub API
- Next.js - For the amazing React framework
- Vercel - For hosting and deployment platform
- Shadcn UI - For the beautiful UI components
If you have any questions or need help, please open an issue on GitHub.