An intelligent GitHub App that automatically reviews every pull request using an orchestrated Claude pipeline. Features a hybrid instant + queue architecture that handles 2000+ PRs/minute.
- β Instant Security Scan (15-30s) β Posted immediately for quick feedback
- π Full Analysis (queued, 5-30min) β All 4 analyzers run asynchronously
- π Security Analysis β Detects vulnerabilities, secrets, injection flaws
- π Bug Detection β Identifies logic errors, race conditions, edge cases
- β¨ Quality Review β Checks readability, maintainability, performance
- π Convention Check β Ensures style consistency and best practices
- β‘ Scalable to 2000 PRs/min β Hybrid queue + instant architecture
- π Durable β Auto-resumes on crashes, retries on transient failures
- π§ Smart β Uses Claude Sonnet 4.6 with optimized pipeline
GitHub Webhook
β
Hono API Route (verify signature)
ββ INSTANT PATH (15-30s)
β ββ Workflow: Security Scan Only
β ββ Fetch PR diff
β ββ Security Analyzer (Claude)
β ββ Post instant comment β‘
β
ββ QUEUE PATH (5-30min, async)
ββ Enqueue full review
ββ Cron: Process queue every 5 min
ββ Workflow: Full Analysis (all 4)
ββ Fetch PR diff
ββ Parallel LLM Analysis
β ββ Security Analyzer
β ββ Bugs Analyzer
β ββ Quality Analyzer
β ββ Conventions Analyzer
ββ Aggregate findings
ββ Post full review comment π
Instant (Security Only)
- Instant feedback on critical vulnerabilities
- Fast (15-30 seconds)
- No rate-limit issues (single analyzer)
- Gives developers immediate actionable insights
Queued (Full Analysis)
- Comprehensive review with all 4 analyzers
- Runs during off-peak or as capacity allows
- Uses in-memory queue (can upgrade to Postgres/Redis)
- Cron job processes every 5 minutes
- Handles rate limits gracefully
Why Vercel Workflow?
- Durability: Survives crashes, auto-resumes
- Step Caching: Results persist, no re-runs
- Scalability: 2000+ concurrent PRs
- Retries: Automatic on transient failures
- Framework: Hono (lightweight, fast)
- Orchestration: Vercel Workflow DevKit
- AI: Claude Sonnet 4.6 via Vercel AI Gateway
- Language: TypeScript
- GitHub API: Octokit
- Node.js 18+
- npm/pnpm
- GitHub account with app creation access
- Vercel account (for deployment)
-
Clone & install
npm install
-
Set up GitHub App (see SETUP.md)
cp .env.local.example .env.local # Fill in GITHUB_APP_ID, GITHUB_PRIVATE_KEY, GITHUB_WEBHOOK_SECRET -
Run locally
npm run dev
-
In another terminal, start Workflow
npx workflow dev
-
Test with a webhook Use GitHub's webhook "Redeliver" feature to test with a past PR event.
-
Push to GitHub
git push
-
Deploy
vercel deploy
-
Set environment variables in Vercel dashboard:
GITHUB_APP_IDGITHUB_PRIVATE_KEY(base64 encoded)GITHUB_WEBHOOK_SECRET- Optionally:
AI_GATEWAY_API_KEY(uses OIDC on Vercel if not set)
-
Update GitHub App webhook URL to your Vercel deployment URL
Once deployed and installed on a repository:
- Create or update a PR in the repository
- Within 15-30 seconds, a comment appears:
## π Security Scan (Instant)- Critical and high-severity vulnerabilities
- Hardcoded secrets, injection risks
- Immediate action items
- Within 5-30 minutes, a follow-up comment appears:
## π Full Code Review (Complete Analysis)- π Security (all findings)
- π Bugs (logic errors, race conditions)
- β¨ Quality (readability, maintainability)
- π Conventions (style, naming, consistency)
Each finding includes:
- Severity level (π΄ critical, π high, π‘ medium, π΅ low)
- File and line number
- Clear issue description
- Suggested fix
src/
βββ index.ts # Hono app entry point
βββ webhooks/
β βββ github.ts # Webhook verification + event routing
βββ workflows/
β βββ pr-review.ts # Main Workflow orchestrator
βββ steps/
β βββ fetch-diff.ts # Fetch PR diff from GitHub
β βββ aggregate.ts # Merge findings into report
β βββ post-comment.ts # Post comment to GitHub
β βββ analyzers/
β βββ security.ts # Security analysis step
β βββ bugs.ts # Bug detection step
β βββ quality.ts # Code quality step
β βββ conventions.ts # Convention checking step
βββ lib/
βββ github.ts # GitHub App client
vercel.ts # Vercel config
SETUP.md # GitHub App setup guide
| Method | Path | Description |
|---|---|---|
| POST | /webhooks/github |
GitHub webhook (PR events) β triggers instant + queue |
| GET | /api/process-queue |
Process queued full reviews (called by cron every 5min) |
| GET | /health |
Health check |
| GET | / |
API info |
# GitHub App
GITHUB_APP_ID=
GITHUB_PRIVATE_KEY= # Base64 encoded PEM
GITHUB_WEBHOOK_SECRET=
# AI Gateway (optional on Vercel, uses OIDC)
AI_GATEWAY_API_KEY=- Review timeout: ~60-90s per PR (default Workflow timeout)
- Diff size: Truncated to top 15 files if >16KB
- Parallel analyzers: 4 concurrent Claude calls
- Rate limiting: Automatic retry with exponential backoff
# Check Workflow health
npx workflow health
# View workflow dashboard
npx workflow web
# Inspect runs
npx workflow inspect runs
# Check specific run
npx workflow inspect run <run_id># View logs
vercel logs
# Check Workflow on production
npx workflow inspect runs --backend vercel --project <project-name>- Latency: 15-30 seconds
- API calls per PR: 2 (fetch diff, post comment)
- LLM calls per PR: 1 (security analyzer)
- Rate limit pressure: Low (can handle 2000/min easily)
- Processing delay: 5-30 minutes (depends on queue depth)
- API calls per PR: 2 (fetch diff, post follow-up comment)
- LLM calls per PR: 4 (all analyzers)
- Rate limit mitigation: Queue + cron scheduling spreads load
- Queue processing: Cron every 5 min, processes ~30-50 PRs per batch
- GitHub API: ~4000 calls/min (2 per PR) = 240K/hour = β Safe (per-installation limit: 5000/hour)
- Claude API: ~5000 calls/min (instant 1x, queued 4x averaged over time) = β Within limits
- Workflow concurrency: Instant jobs run concurrently, queued jobs batch-processed
- Infrastructure: Hono handles concurrent webhook processing seamlessly
- Configurable analyzer prompts per repo/team
- Historical trend tracking (improvements over time)
- Custom rules engine for organization-specific checks
- Integration with other tools (JIRA, Slack notifications)
- Batch PR analysis for large changes
- Cost optimization (cache results, reduce redundant calls)
This is a demonstration project. Feel free to fork and customize!
MIT
Built with: Hono Β· Vercel Workflow Β· Claude AI Β· GitHub API