A real-time GitHub activity monitoring system that transforms webhook events into actionable engineering intelligence through AI-powered analysis.
- Overview
- Architecture
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Database Schema
- Security
- Roadmap
- Contributing
- License
Git Watch is an event-driven backend pipeline that captures GitHub webhook events and provides intelligent insights through AI-powered analysis. It uses a persona-based routing system to audit developer workflows, generate weekly changelogs, and deliver strict architectural feedback.
- Real-time Event Capture: Monitors pushes, pull requests, issues, stars, and forks
- AI-Powered Analysis: Dual-persona system for management and technical auditing
- Automated Workflow Audits: Identifies code quality issues and development patterns
- Community Tracking: Monitors repository engagement metrics
The system follows an event-driven architecture with clear separation of concerns:
βββββββββββββββ
β GitHub β
β Webhooks β
ββββββββ¬βββββββ
β
β HTTPS (ngrok tunnel)
ββββββββββββββββββββββββ
β Ingestion Layer β
β β’ Express Server β
β β’ HMAC Verification β
ββββββββ¬ββββββββββββββββ
β
β
ββββββββββββββββββββββββ
β Storage Layer β
β β’ Supabase (PostgreSQL) β
β β’ JSONB Payloads β
ββββββββ¬ββββββββββββββββ
β
β
ββββββββββββββββββββββββ
β Intelligence Layer β
β β’ Gemini 2.0 Flash β
β β’ Persona Routing β
ββββββββ¬ββββββββββββββββ
β
β
ββββββββββββββββββββββββ
β Delivery Layer β
β β’ Discord Webhooks β
β β’ Message Chunking β
ββββββββββββββββββββββββ
Ingestion Layer
- Node.js + Express server
- HMAC SHA-256 signature verification
- Ngrok tunnel for local development
Storage Layer
- Supabase (PostgreSQL) for persistence
- JSONB columns for flexible schema
- Indexed queries for performance
Intelligence Layer
- The Manager Persona: Focuses on features, fixes, community engagement
- The Strict Auditor Persona: Analyzes engineering quality, commit patterns
Delivery Layer
- Discord webhook integration
- Recursive message chunking (2,000 char limit)
- Identifies vague commit messages
- Detects coding without linked issues
- Flags architectural anti-patterns
- Manager View: Feature delivery, bug fixes, community growth
- Auditor View: Code quality, engineering practices, technical debt
- Push events
- Pull request lifecycle
- Issue tracking
- Repository engagement (stars/watches)
- Star/watch tracking
- Contributor activity
- Project growth metrics
Before you begin, ensure you have the following installed:
- Node.js v18.0.0 or higher
- pnpm or npm package manager
- Git for version control
You'll also need accounts for:
- Supabase (PostgreSQL database)
- Google AI Studio (Gemini API)
- GitHub (webhook configuration)
- Discord (optional, for notifications)
git clone https://github.com/Taophycc/git-watch.git
cd git-watchpnpm install- Create a new project at supabase.com
- Navigate to Project Settings β Database
- Copy the connection string from the Connection string section
- Run the database schema (see Database Schema)
# Install PostgreSQL
brew install postgresql # macOS
# or use your system's package manager
# Create database
createdb gitwatchCreate a .env file in the project root:
# Server Configuration
PORT=3000
NODE_ENV=development
# GitHub Webhook
GITHUB_WEBHOOK_SECRET=your_webhook_secret_here
DATABASE_URL=postgresql://postgres:[PASSWORD]@[HOST]:5432/postgres
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your_supabase_anon_key
GEMINI_API_KEY=your_google_gemini_api_key
DISCORD_WEBHOOK_URL=your_discord_webhook_url- Go to your GitHub repository β Settings β Webhooks β Add webhook
- Payload URL:
https://your-ngrok-url.ngrok.io/webhook - Content type:
application/json - Secret: Use the same value as
GITHUB_WEBHOOK_SECRETin your.env - Events: Select individual events:
- Pushes
- Pull requests
- Issues
- Stars
- Forks
# Install ngrok
pnpm install -g ngrok
# Start tunnel (in separate terminal)
ngrok http 3000pnpm run devThe server will start on http://localhost:3000
- Test endpoint: Visit
http://localhost:3000- should return "GitWatch is running ποΈ" - Test database: Check console for "β Connected to Supabase"
- Trigger webhook: Perform an action on GitHub (e.g., push code, open issue)
- Check logs: Console should show incoming webhook events
npm run dev
npm run build
npm start
npm run type-check Run this SQL in your Supabase SQL Editor or via psql:
-- Events table
CREATE TABLE github_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
github_delivery_id VARCHAR(255) UNIQUE NOT NULL,
event_type VARCHAR(100) NOT NULL,
repository_name VARCHAR(255),
sender_name VARCHAR(255),
payload JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
### Schema Design Notes
- **`github_delivery_id`**: Unique identifier from GitHub (prevents duplicate processing)
- **`payload`**: JSONB column stores full webhook payload for flexibility
- **`event_type`**: Indexed for fast filtering (push, pull_request, issues, etc.)
- **`created_at`**: Timestamptz for accurate timezone handling
---
## Security
### HMAC Signature Verification
All incoming webhooks are verified using HMAC SHA-256 signatures to ensure authenticity:
```typescript
// Signature verification middleware
const signature = req.headers['x-hub-signature-256'];
const hmac = crypto.createHmac('sha256', WEBHOOK_SECRET);
hmac.update(JSON.stringify(req.body));
const calculatedSignature = 'sha256=' + hmac.digest('hex');
// Timing-safe comparison
crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(calculatedSignature)
);- GitHub webhook ingestion
- HMAC signature verification
- PostgreSQL storage with JSONB
- Basic event logging
- Gemini AI integration
- Persona-based routing
- Weekly changelog generation
- Automated code quality reports
- Smart Alerts: Real-time AI scanning for leaked API keys
- Multi-Repository Support: Track multiple projects in one pipeline
- Contributor Dashboard: Frontend visualization of metrics
- Slack Integration: Alternative to Discord notifications
- Multi-user authentication (GitHub OAuth)
- Custom webhook routing per repository
- API for querying historical data
- Export to CSV/JSON
Contributions are welcome! Please follow these steps:
- 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
- Follow existing code style (TypeScript + ES Modules)
- Add tests for new features
- Update documentation as needed
- Keep commits atomic and well-described
Distributed under the MIT License. See LICENSE file for more information.
Project Maintainer: Your Name
- GitHub: @yourusername
- Email: your.email@example.com
Project Link: https://github.com/yourusername/git-watch
- GitHub Webhooks Documentation
- Supabase for PostgreSQL hosting
- Google Gemini for AI capabilities
- Express.js for web framework
- ngrok for local webhook testing