This document provides setup instructions for running CommitPulse locally, configuring database tracking, and deploying to production.
# 1. Clone the repository
git clone https://github.com/JhaSourav07/commitpulse.git && cd commitpulse
# 2. Install dependencies
npm install
# 3. Create your environment file
cat > .env.local << 'EOF'
GITHUB_TOKEN=your_github_pat_here
# GITHUB_PAT is also accepted as an alias for GITHUB_TOKEN
# Optional — enables user tracking (see below)
# MONGODB_URI=mongodb+srv://...
EOF
# 4. Start the development server
npm run dev📌 Token Scope: Your GitHub Personal Access Token needs the
read:userscope only. No write permissions required.
Then visit: http://localhost:3000/api/streak?user=YOUR_USERNAME
Tip
If port 3000 is already in use by another application, you can start the development server on a custom port using:
npm run dev -- -p 3001CommitPulse records the GitHub username of everyone who generates a monolith from the landing page into a MongoDB collection. This is entirely optional for local development — the app works perfectly without it.
If MONGODB_URI is not set, the /api/track-user endpoint will log a warning and skip the database write gracefully:
WARN: MONGODB_URI is not set. Bypassing user tracking for local development.
To enable tracking locally, add your connection string to .env.local:
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/commitpulseFor production (Vercel), add MONGODB_URI to your project's Environment Variables settings.
Badge/SVG contribution data is cached and refreshes automatically once the cache TTL expires. If you want a badge to update immediately after a push instead of waiting out the TTL, configure a GitHub webhook that invalidates the cache on each push:
-
Add a shared secret to your environment:
GITHUB_WEBHOOK_SECRET=a_long_random_secret
-
In your GitHub repository settings, go to Settings → Webhooks → Add webhook and set:
- Payload URL:
https://<your-deployment>/api/webhooks/github - Content type:
application/json - Secret: the same value as
GITHUB_WEBHOOK_SECRET - Which events: just the
pushevent
⚠️ Note the URL: the correct endpoint is/api/webhooks/github(pluralwebhooks). This is the only webhook endpoint in CommitPulse — it validates the signature and invalidates the cached contribution data for the pusher. - Payload URL:
This step is entirely optional — without it, badges still update on their own once the cache expires.
Set the GITHUB_TOKEN environment variable in your Vercel project settings, and you're live.
Note: Both
GITHUB_TOKENandGITHUB_PATare accepted.GITHUB_TOKENis the canonical name used throughout the codebase;GITHUB_PATworks as an alias for backwards compatibility.