A beautiful, interactive GitHub contribution tracker that displays your coding activity with rolling time periods. Perfect for monitoring your GitHub streak and visualizing your development journey!
- Interactive Line Chart: Beautiful Chart.js visualization of daily contributions
- Contribution Heatmap: GitHub-style contribution calendar with hover tooltips
- Multiple Time Periods: View contributions for different rolling periods
- 1 Week
- 1 Month
- 90 Days
- 6 Months
- 1 Year
- Real-time Statistics: Track total commits, active days, PRs, and current streak
- Responsive Design: Beautiful UI that works on desktop and mobile
- Live Data: Fetches real-time data from GitHub API
- Modern UI: Glass-morphism design with smooth animations
- Node.js (v14 or higher)
- npm or yarn
- GitHub Personal Access Token
-
Clone the repository
git clone <your-repo-url> cd gitgraph
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env
file in the root directory:GITHUB_TOKEN=your_github_personal_access_token GITHUB_USERNAME=your_github_username PORT=3000
-
Create GitHub Personal Access Token
- Go to GitHub Settings > Developer Settings > Personal Access Tokens
- Click "Generate new token (classic)"
- Give it a descriptive name like "GitGraph App"
- Select the following scopes:
read:user
(to access your profile information)
- Copy the token and add it to your
.env
file
-
Start the application
npm start
-
Open your browser
Navigate to
http://localhost:3000
to view your GitHub contributions!
For development with auto-restart on file changes:
npm run dev
gitgraph/
├── server.js # Express server with GitHub API integration
├── package.json # Project dependencies and scripts
├── .env.example # Environment variables template
├── .gitignore # Git ignore file
├── LICENSE # GPL-3.0 License
├── README.md # This file
└── public/ # Frontend assets
├── index.html # Main HTML structure
├── styles.css # CSS styling with glass-morphism design
└── app.js # JavaScript for interactivity and charts
GET /
- Serve the main applicationGET /api/user
- Get GitHub user informationGET /api/contributions/:period
- Get contributions for specified periodGET /health
- Health check endpoint
1week
- Past 7 days1month
- Past 30 days90day
- Past 90 days6month
- Past 180 days1year
- Past 365 days
- Smooth line chart showing daily contribution count
- Hover tooltips with detailed information
- Responsive design that adapts to screen size
- Beautiful color gradient and animations
- GitHub-style calendar heatmap
- Color-coded contribution levels
- Hover tooltips showing exact dates and counts
- Scrollable for longer time periods
- Total Commits: Overall commit count for the selected period
- Active Days: Number of days with at least one contribution
- Pull Requests: Total PRs created in the period
- Current Streak: Current consecutive days of contributions
- Refresh button to get latest data
- Automatic error handling and retry mechanisms
- Loading states with smooth transitions
Edit the CSS variables in public/styles.css
:
/* Example color modifications */
.stat-icon.commits {
background: linear-gradient(45deg, #your-color-1, #your-color-2);
}
- Add the period to the dropdown in
public/index.html
- Add the period logic in
server.js
getDateRange()
function - Add the display name in
public/app.js
updatePeriodDisplay()
function
1. "Missing required environment variables" error
- Make sure you have created a
.env
file withGITHUB_TOKEN
andGITHUB_USERNAME
- Verify your GitHub token has the correct permissions
2. "Failed to fetch contributions" error
- Check that your GitHub token is valid and not expired
- Ensure your username is spelled correctly
- Verify you have an internet connection
3. Chart not displaying
- Check browser console for JavaScript errors
- Ensure all dependencies are installed (
npm install
) - Try refreshing the page
- Use the browser's developer tools to debug API calls
- Check the Network tab to see if API requests are successful
- The server logs will show detailed error messages
The application uses GitHub's GraphQL API, which has the following rate limits:
- 5,000 requests per hour for authenticated requests
- Each query in this app counts as 1 request
- Rate limit resets every hour
For normal usage, you shouldn't hit these limits, but if you do:
- Wait for the rate limit to reset
- Consider caching data on the backend for high-traffic scenarios
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Chart.js for the beautiful charts
- GitHub API for providing contribution data
- Font Awesome for the icons
Happy coding! Keep that GitHub streak alive! 🔥