A minimal GitHub App that listens for opened pull requests and posts an AI-generated PR description as a comment.
This is the Week 1 deliverable of the CEO-led bootstrap sprint for GitReview. It validates whether engineering teams will pay for an AI-powered PR Assistant before committing to the full MVP build.
- Node.js 20 + TypeScript
- Express (local / Render)
- Serverless adapter for Vercel (
src/vercel.ts) - @octokit/webhooks + @octokit/rest + @octokit/auth-app
- Anthropic Claude API
- Listens for
pull_request.openedwebhooks from GitHub. - Authenticates as the GitHub App installation that owns the event.
- Fetches the PR diff.
- Sends the diff + original title/body to Claude.
- Posts the generated description as a PR comment.
- Skips if a GitReview comment already exists (idempotent).
- A GitHub App with:
- App ID and private key (PEM)
- Webhook secret
- Permissions:
Pull requests(read),Issues(write, to post comments),Contents(read, for diffs) - Subscribe to
Pull requestevents
- An Anthropic API key
-
Install dependencies:
npm install
-
Copy
.env.exampleto.envand fill in credentials:cp .env.example .env
For local testing with a personal access token you can use
GITHUB_TOKENinstead ofGITHUB_APP_ID/GITHUB_PRIVATE_KEY. For the real webhook flow, use the GitHub App credentials. -
Start the dev server:
npm run dev
-
Expose locally (e.g., ngrok) and configure the GitHub App webhook URL to
https://your-tunnel/webhooks. -
Open a PR in a repo where the app is installed.
- Push this repo to GitHub.
- Import the repo in Vercel.
- Add environment variables in the Vercel dashboard:
GITHUB_APP_IDGITHUB_PRIVATE_KEYGITHUB_WEBHOOK_SECRETANTHROPIC_API_KEYANTHROPIC_MODEL(optional, defaults toclaude-sonnet-4-6)
- Set the GitHub App webhook URL to
https://your-project.vercel.app/webhooks.
The included vercel.json routes /webhooks and /health to src/vercel.ts.
- Push this repo to GitHub.
- In Render, choose New > Blueprint and point it at
render.yaml. - Fill in the secret environment variables when prompted.
- Render builds with
npm run buildand starts withnpm start. - Set the GitHub App webhook URL to
https://your-service.onrender.com/webhooks.
GET /healthshould return{"status":"ok","version":"0.1.0"}.- Open a pull request in a repo with the app installed.
- The PR should receive a comment starting with
## AI-generated PR description.
src/
index.ts # Express entry point (local / Render)
vercel.ts # Serverless handler (Vercel)
github.ts # GitHub App auth, diff fetch, comment post
claude.ts # Claude API prompt and response handling
Week 2 validation: MIN-5