Build Your GitHub Activity Streak β Securely & Ethically
A free, open-source GitHub App that helps developers maintain daily GitHub habits without Personal Access Tokens.
β οΈ Ethics Disclaimer: Automated commits do NOT represent real development work. This tool is designed for learning and habit-building purposes only. Always be transparent about your contributions.
- Features
- Tech Stack
- Quick Start (Users)
- Installation (Developers)
- Environment Variables
- Architecture
- Project Structure
- API Reference
- Security
- Deployment
- FAQ
- Contributing
- License
- Acknowledgments
| Feature | Description |
|---|---|
| π Secure Authentication | GitHub App OAuth β no PATs or passwords required |
| π Google OAuth Support | Alternative sign-in with Google account |
| π Non-destructive Changes | Only modifies README formatting (whitespace) |
| β° Smart Scheduling | Automatically skips days when you have real commits |
| π― Daily Limits | Maximum 5 automated commits per day per repository |
| π Full Control | Pause, resume, or uninstall anytime |
| π Activity Dashboard | Track automation history with beautiful UI |
| π§ Email Notifications | Get notified about important events |
| π Analytics | Discord webhook integration for visitor analytics |
| π± Beginner-Friendly | Learn GitHub automation safely |
| Frontend | Backend | Database | Infrastructure |
|
|
|
|
Getting started with Commit Habit takes less than 2 minutes:
Go to commithabit.vercel.app
Click "Get Started" and authenticate with your GitHub or Google account.
Click "Add Repository" and install the Commit Habit app on your selected repositories.
Toggle automation ON for any connected repository. That's it! π
- Node.js 18.0 or higher
- npm or yarn or pnpm
- PostgreSQL database (Supabase recommended)
- GitHub Account for creating a GitHub App
git clone https://github.com/HakkanShah/commit-habit.git
cd commit-habitnpm install
# or
yarn install
# or
pnpm install- Navigate to GitHub Settings β Developer settings β GitHub Apps
- Click "New GitHub App"
- Configure the following:
| Field | Value |
|---|---|
| App Name | commit-habit (must be unique) |
| Homepage URL | https://your-app.vercel.app |
| Callback URL | https://your-app.vercel.app/api/auth/callback |
| Setup URL | https://your-app.vercel.app/api/auth/callback |
| Webhook URL | https://your-app.vercel.app/api/github/webhook |
| Webhook Secret | Generate with openssl rand -hex 32 |
-
Set Permissions:
Permission Access Level Repository contents Read & Write Metadata Read -
Subscribe to Events:
- β Installation
- β Installation repositories
-
Click "Create GitHub App"
-
Generate and download a Private Key (
.pemfile) -
Note your App ID, Client ID, and Client Secret
cp .env.example .env.localFill in your values (see Environment Variables section).
# Initialize Prisma and run migrations
npx prisma migrate dev --name init
# Generate Prisma Client
npx prisma generatenpm run devOpen http://localhost:3000 in your browser.
Create a .env.local file in the root directory with the following variables:
| Variable | Description | Example |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://user:pass@host:5432/db |
GITHUB_APP_ID |
Your GitHub App ID | 123456 |
GITHUB_APP_CLIENT_ID |
OAuth Client ID | Iv1.xxxxxxxxxx |
GITHUB_APP_CLIENT_SECRET |
OAuth Client Secret | xxxxxxxxxxxxxxxx |
GITHUB_WEBHOOK_SECRET |
Webhook signature secret | openssl rand -hex 32 |
GITHUB_APP_PRIVATE_KEY |
RSA Private Key content | -----BEGIN RSA... |
NEXT_PUBLIC_APP_URL |
Application base URL | http://localhost:3000 |
NEXT_PUBLIC_GITHUB_APP_NAME |
GitHub App name | commit-habit |
CRON_SECRET |
Secret for cron endpoint | openssl rand -hex 32 |
SESSION_SECRET |
Session encryption secret | openssl rand -hex 32 |
| Variable | Description | Example |
|---|---|---|
SMTP_HOST |
Email SMTP host | smtp.gmail.com |
SMTP_PORT |
Email SMTP port | 587 |
SMTP_USER |
Email username | your-email@gmail.com |
SMTP_PASS |
Email app password | Gmail App Password |
SMTP_FROM |
From email address | CommitHabit <noreply@example.com> |
DISCORD_WEBHOOK_URL |
Discord webhook for analytics | Webhook URL |
ADMIN_EMAIL |
Admin notification email | admin@example.com |
The private key must be converted to a single-line format:
# Linux/macOS
cat private-key.pem | tr '\n' '~' | sed 's/~/\\n/g'
# Or copy directly with newlines in the .env file (inside quotes)βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User's Browser β
β ββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββββ β
β β Landing Page ββββΆβ OAuth Install ββββΆβ Dashboard β β
β β β β (GitHub/Google)β β (Manage Repos) β β
β ββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js Application (Vercel) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API Routes β β
β β βββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββββ β β
β β β /api/auth/* β β /api/github/* β β /api/cron/daily β β β
β β β OAuth Flows β β Webhook Handler β β Scheduled Jobs β β β
β β βββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββββ β β
β β βββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββββ β β
β β β /api/install* β β /api/analytics β β /api/health β β β
β β β Manage Repos β β Visitor Tracking β β Health Check β β β
β β βββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββ΄ββββββββββββββββββββ
βΌ βΌ
ββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββ
β Supabase PostgreSQL β β GitHub API β
β ββββββββββββββββββββββββββββ β β β’ Check user commits β
β β Users β β β β’ Read README content β
β β Accounts (Multi-Provider)β β β β’ Create automated commit β
β β Installations β β β β’ Manage app installations β
β β ActivityLogs β β β β
β ββββββββββββββββββββββββββββ β ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ
commit-habit/
βββ π prisma/
β βββ schema.prisma # Database schema (User, Account, Installation, ActivityLog)
β
βββ π public/
β βββ icon.png # App favicon
β βββ logo.png # App logo
β βββ manifest.json # PWA manifest
β βββ robots.txt # SEO robots file
β βββ sitemap.xml # SEO sitemap
β
βββ π src/
β βββ π app/
β β βββ π api/
β β β βββ π auth/
β β β β βββ callback/ # OAuth callback handler
β β β β βββ logout/ # Logout handler
β β β β βββ me/ # Current user endpoint
β β β β βββ google/ # Google OAuth
β β β βββ π cron/
β β β β βββ daily/ # Daily automation cron job
β β β βββ π github/
β β β β βββ webhook/ # GitHub webhook handler
β β β βββ π installations/ # Repository management
β β β βββ π analytics/ # Visitor analytics
β β β βββ π health/ # Health check endpoint
β β β
β β βββ π dashboard/
β β β βββ page.tsx # Dashboard page
β β β βββ dashboard-client.tsx
β β β βββ installation-card.tsx
β β β
β β βββ favicon.ico
β β βββ globals.css # Global styles & Tailwind
β β βββ layout.tsx # Root layout with SEO
β β βββ page.tsx # Landing page
β β βββ providers.tsx # React providers
β β
β βββ π components/
β β βββ animated-terminal.tsx # Terminal animation
β β βββ contribution-demo.tsx # Contribution graph demo
β β βββ contribution-graph.tsx # GitHub contribution graph
β β βββ hero-comparison.tsx # Before/after comparison
β β βββ hero-sequence.tsx # Hero animation sequence
β β βββ skeleton.tsx # Loading skeletons
β β βββ toast.tsx # Toast notifications
β β βββ workflow-animation.tsx # Workflow demo
β β βββ ... # Other UI components
β β
β βββ π lib/
β βββ analytics.ts # Analytics & Discord webhook
β βββ api-client.ts # Frontend API client
β βββ auth.ts # Session management
β βββ email.ts # Email service
β βββ errors.ts # Error handling utilities
β βββ github.ts # GitHub API utilities
β βββ prisma.ts # Database client
β βββ sounds.ts # Sound effects
β βββ utils.ts # Helper functions
β
βββ .env.example # Environment variables template
βββ next.config.ts # Next.js configuration
βββ package.json # Dependencies
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
βββ vercel.json # Vercel cron configuration
| Endpoint | Method | Description |
|---|---|---|
/api/auth/callback |
GET | GitHub OAuth callback handler |
/api/auth/google |
GET | Google OAuth initiation |
/api/auth/google/callback |
GET | Google OAuth callback |
/api/auth/logout |
POST | Logout and clear session |
/api/auth/me |
GET | Get current authenticated user |
| Endpoint | Method | Description |
|---|---|---|
/api/installations |
GET | List user's connected repositories |
/api/installations/[id] |
PATCH | Toggle automation for a repository |
/api/installations/[id] |
DELETE | Remove a repository |
| Endpoint | Method | Description |
|---|---|---|
/api/github/webhook |
POST | GitHub webhook receiver |
/api/cron/daily |
GET | Daily automation job (protected) |
/api/health |
GET | Health check endpoint |
/api/analytics |
POST | Visitor analytics |
Commit Habit implements enterprise-grade security practices:
| Aspect | Implementation |
|---|---|
| Authentication | GitHub App OAuth (no PAT exposure) |
| Token Storage | Access tokens are never stored β generated on-demand via JWT |
| Private Keys | Stored only as environment variables, never in code |
| Webhooks | HMAC-SHA256 signature verification |
| Sessions | HTTP-only secure cookies with encryption |
| Cron Protection | Secret header validation for scheduled jobs |
| Revocation | Users can uninstall anytime from GitHub settings |
| Data Privacy | Minimal data collection, GDPR-friendly |
- Push your repository to GitHub
- Import the project at vercel.com/new
- Add all environment variables from
.env.example - Deploy β Vercel handles the rest!
The vercel.json includes a cron job running daily at 6 AM UTC:
{
"crons": [
{
"path": "/api/cron/daily",
"schedule": "0 6 * * *"
}
]
}- Update GitHub App URLs to your Vercel domain
- Run database migrations:
npx prisma migrate deploy - Verify webhook delivery in GitHub App settings
- Test the OAuth flow end-to-end
Why use a GitHub App instead of Personal Access Tokens?
- More Secure: No long-lived tokens stored in the database
- User Control: Can be uninstalled anytime from GitHub settings
- Transparent: Clear permissions displayed during installation
- Learning Opportunity: Teaches real-world authentication patterns
What exactly does the automation do?
It toggles trailing whitespace in your README.md file. This creates a minimal, non-destructive commit that maintains your activity streak without modifying actual code.
How do I uninstall Commit Habit?
- Go to GitHub Settings β Applications
- Find "Commit Habit"
- Click "Configure" β "Uninstall"
Your data will be automatically cleaned up.
Can I self-host this?
Absolutely! Follow the Installation guide to deploy your own instance. You'll need to create your own GitHub App and database.
Contributions are welcome! Here's how you can help:
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/commit-habit.git - 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
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License β see the LICENSE file for details.