A Next.js application that embeds GitHub contribution graphs into Notion pages with customizable themes.
Notion GitHub Tracker is a dynamic Next.js 15 application designed to seamlessly integrate GitHub user contribution data into Notion. This tool offers a convenient way to track and display GitHub contributions directly within a Notion page using GitHub's official GraphQL API.
The project is deployed at https://notion-github-graph.vercel.app/
URL Pattern: https://notion-github-graph.vercel.app/:username?theme=dark|light
- Replace
:usernamewith any GitHub username - Optional
themeparameter:dark(default) orlight
Example: https://notion-github-graph.vercel.app/kossakovsky?theme=dark
- GitHub GraphQL API Integration - Uses official GitHub API for reliable data fetching
- Dual Theme Support - Light and dark themes that match GitHub's color palette
- Server-Side Rendering - Fast initial page loads with Next.js SSR
- ISR Caching - 1-hour cache revalidation for optimal performance
- Accessibility - Full ARIA label support for screen readers
- SEO Optimized - Dynamic metadata generation with Open Graph tags
- Error Handling - User-friendly error messages for common issues
- Loading States - Skeleton UI with pulse animation
- Node.js (version 18 or higher recommended)
- npm, yarn, pnpm, or bun package manager
- Clone the repository:
git clone https://github.com/kossakovsky/notion-github-graph.git
cd notion-github-graph- Install dependencies:
npm install
# or
yarn install- Configure GitHub Token:
# Copy the example environment file
cp env.example .env.local
# Edit .env.local and add your GitHub Personal Access Token
# Get your token at: https://github.com/settings/tokens
# No special scopes are required - just create a token with public access- Start the development server:
npm run dev
# or
yarn dev- Open http://localhost:3000 in your browser
# Development server
npm run dev
# Production build
npm run build
# Start production server
npm start
# Run ESLint
npm run lintNavigate to the deployed URL with any GitHub username:
https://notion-github-graph.vercel.app/username?theme=dark
Parameters:
username(required) - Any valid GitHub usernametheme(optional) - Eitherdarkorlight(defaults todark)
To embed the contribution graph in Notion:
- In your Notion page, type
/embedand select "Embed" block - Paste the URL with your desired username:
https://notion-github-graph.vercel.app/yourusername?theme=dark - Adjust the embed block size (recommended minimum width: 600px)
- The graph will update automatically every hour via ISR caching
Note: Notion embeds may not display perfectly on mobile devices due to the fixed-width layout.
- Framework: Next.js 15.5.6 (App Router)
- Runtime: React 19.2.0
- Language: TypeScript 5
- Styling: Tailwind CSS 3.4.18 + CSS Modules
- Data Source: GitHub GraphQL API (authenticated)
- Deployment: Vercel
- Analytics: Vercel Analytics
src/
├── app/
│ ├── layout.tsx # Root layout with metadata
│ ├── page.tsx # Home page
│ ├── globals.css # Global styles
│ └── [username]/
│ ├── page.tsx # Dynamic route for user graphs
│ ├── page.module.css # Contribution graph styles
│ ├── loading.tsx # Loading skeleton
│ └── error.tsx # Error boundary
└── utils.ts # API and data transformation logic
- Data Fetching: When you visit
/:username, the app queries GitHub's GraphQL API for the user's contribution calendar - Data Transformation: Raw contribution data is transformed into a 52-week × 7-day grid layout
- Rendering: Contributions are displayed as colored squares with hover tooltips
- Caching: Results are cached for 1 hour using Next.js ISR (Incremental Static Regeneration)
The application uses GitHub's authenticated GraphQL API, which requires a Personal Access Token. Rate limits:
- Without token: 60 requests per hour per IP address (will cause errors)
- With token: 5,000 requests per hour per token
The 1-hour ISR caching significantly reduces API calls, making the token rate limit more than sufficient for most use cases.
- Go to GitHub Settings > Personal Access Tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give it a descriptive name (e.g., "Notion GitHub Graph")
- No scopes are required for public data access
- Generate and copy the token
- Add it to your
.env.localfile:GITHUB_TOKEN=ghp_your_token_here
For Vercel deployment, add the token as an environment variable in your project settings.
Contributions are welcome! Here's how you can help:
- 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
- The project has no test suite configured - manual testing is required
- The grid layout logic in
sortContributions()(utils.ts) is complex and critical - test thoroughly when modifying - Server components use async/await for params (Next.js 15 requirement)
- Not responsive - Fixed-width grid doesn't adapt well to mobile screens
- Requires GitHub token - Must configure GITHUB_TOKEN environment variable
- 52-week fixed display - Always shows exactly one year of data
- No contribution breakdown - Shows total count only (no separation of commits, PRs, reviews)
Major Changes:
- Migrated from web scraping to GitHub GraphQL API
- Upgraded to Next.js 15 and React 19
- Enhanced error handling with user-friendly messages
- Added loading skeleton UI
- Improved accessibility with full ARIA support
- Added dynamic SEO metadata
- Security: Username validation to prevent injection attacks
Dependency Updates:
- Next.js: 14.x → 15.5.6
- React: 18.x → 19.2.0
- Added: classnames, @vercel/analytics
- Removed: cheerio (no longer needed)
- GitHub: kossakovsky
- Telegram: @kossakovsky
- Built with Next.js
- Data from GitHub GraphQL API
- Deployed on Vercel

