Skip to content

About

GitHub App that reviews pull requests and shows results in a React dashboard.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

AutoReviewer

A GitHub App that reviews pull requests with an LLM, and a React dashboard that shows what it found.

Live site: https://autoreviewerapp-mu.vercel.app (landing page) · /demo (the dashboard with public demo data) · API: https://pr-sentinel-server.onrender.com/health. The backend runs on Render's free tier, so the first load after a quiet period can take about a minute.

When a PR is opened or updated, GitHub sends a webhook to an Express server. The server verifies the signature, answers 202 straight away, and reviews the PR in the background: it fetches the changed files, drops noise (lock files, build output, binaries, huge diffs), and sends each remaining file's diff to a free LLM (Groq, with Google Gemini as fallback). The answer is validated with Zod and checked against the real diff, so only comments on lines the PR actually added survive. The top five findings (real bugs, security issues, missing error handling, logic errors, never style) are posted as one review with inline comments and a summary. Every review is stored in MongoDB and shown in the dashboard.

GitHub ──webhook──▶ Express ──202──▶ GitHub
                       │ verify HMAC · validate · de-duplicate
                       ▼
                  review queue (one PR at a time)
                       │
     GitHub API ◀──────┤ fetch files → filter noise
                       │
      Groq ▶ Gemini ◀──┤ one file per request, validated output
                       │
     GitHub API ◀──────┤ post one review: summary + inline comments
                       ▼
                    MongoDB ◀── REST API ◀── React dashboard

Design and decisions: docs/PLAN.md. What a self-review of the code found: docs/CODE_REVIEW.md. Concepts explained for learning: docs/LEARNING.md.

Cost: $0

Hard rule for this project: every service is on a free plan that needs no credit card and no billing account.

Service Used for Free-tier limits that matter
Groq Primary LLM (openai/gpt-oss-120b) 30 requests/min, 8,000 tokens/min, 1,000 requests/day, 200,000 tokens/day (checked on Groq's rate-limits page, Nov 2026)
Google AI Studio (Gemini) Fallback LLM Quota varies by model and changes often; check your own at aistudio.google.com/rate-limit. Never attach a billing account to the project.
MongoDB Atlas M0 Database 512 MB storage, shared CPU/RAM
Render free web service Backend hosting Sleeps after 15 min idle (cold start of about a minute); 750 instance hours/month
Vercel Hobby Frontend hosting Free for personal, non-commercial use
smee.io Local webhook forwarding Free, no account
GitHub App PR integration Free; GitHub REST API limit 5,000 requests/hour per installation

Limits are copied from each provider's documentation and can change; re-check them before relying on them.

Install

AutoReviewer is a free beta. Install it on the repositories you want reviewed: https://github.com/apps/autoreviewer-app/installations/new. Then open a PR and see reviews at https://autoreviewerapp-mu.vercel.app/dashboard (Sign in with GitHub).

  • Cost: free. Limits: 10 files per day per installation plus a shared daily budget; 10 files per PR.
  • Privacy: diffs go to Groq (Gemini fallback for public repositories only); no code is stored; reviews are deleted after 90 days or on uninstall.
  • Opt out: skip-sentinel label or [skip sentinel] in the title; or remove the repository from the installation.
  • Uninstall: https://github.com/settings/installations deletes your stored reviews.
  • Report a problem: open an issue.

More in docs/BETA.md.

Run it locally

Needs Node 22.20 or newer.

npm run install:all
cp server/.env.example server/.env     # fill in the values, see "One-time setup"
npm run dev:server    # http://localhost:3000/health
npm run dev:client    # http://localhost:5173 (the site; it forwards /api and /auth to :3000)
npm test              # server and client tests
npm run lint

To run the whole loop on your machine, forward GitHub's webhooks with smee.io:

npm run dev:server                                  # terminal 1
npm run smee                                        # terminal 2: smee.io -> localhost:3000/webhooks/github
npm --prefix server run smoke:llm -- groq           # optional: check each LLM key first
npm --prefix server run smoke:llm -- gemini

Then install the App on a public throwaway repo and open a PR. The files in demo/ have deliberate bugs for exactly this.

One-time setup

These steps need your accounts, so they are yours to do.

  1. MongoDB Atlas: create a free M0 cluster, a database user, and allow network access for Render. Render's free tier has no fixed IP, but it publishes its outbound ranges (service page → Connect → Outbound); add those ranges to the Atlas IP Access List, which is safer than 0.0.0.0/0 (and Atlas may reject 0.0.0.0/0 anyway). Copy the connection string into MONGODB_URI.
  2. Groq: create an API key at console.groq.com/keys → GROQ_API_KEY.
  3. Gemini: create an API key in Google AI Studio, without a billing account. Open aistudio.google.com/rate-limit, pick a Flash model that shows free quota → GEMINI_MODEL.
  4. GitHub App (Settings → Developer settings → GitHub Apps → New):
    • Webhook URL: your smee.io channel while developing, https://<your-render-service>.onrender.com/webhooks/github in production.
    • Webhook secret: a long random string → GITHUB_WEBHOOK_SECRET.
    • Repository permissions: Pull requests: Read and write, Contents: Read-only, Metadata: Read-only.
    • Subscribe to events: Pull request, Installation and Installation repositories (the last two delete stored reviews when the App is uninstalled or a repository is removed).
    • After creating it, note the App ID → GITHUB_APP_ID, and generate a private key (.pem). Put it in GITHUB_PRIVATE_KEY on one line with each newline written as \n. Never commit the .pem (it is git-ignored).
  5. Local webhooks: open smee.io, start a channel, put its URL in WEBHOOK_PROXY_URL.

Deploy

Backend on Render. New → Blueprint, choose this repository; render.yaml describes the service. Enter the secrets it asks for (sync: false ones; render.env.example lists them all with placeholders). Set CLIENT_ORIGIN to your Vercel URL, with no trailing path. Afterwards, change the GitHub App's webhook URL to the Render URL.

Frontend on Vercel. New Project → import the repository and set the Root Directory to client. There is no API URL setting: client/vercel.json forwards /api/* and /auth/* to the Render service, so the browser only ever talks to the dashboard's own origin and the sign-in cookie is first-party. The same file serves deep links such as /reviews/<id> and sets the security headers.

Check it:

  1. https://<render-url>/health returns {"status":"ok", ...} with "db":"connected".
  2. Open a PR on a repository the App is installed on and watch it get reviewed.
  3. Check the rate limiter sees visitors, not the proxy: the RateLimit response header carries a pk= partition key. Request /api/stats directly on the Render URL and through the dashboard origin; if the two keys differ, set TRUST_PROXY_HOPS=2 on Render so each visitor gets their own bucket instead of everyone sharing Vercel's.

The free tier sleeps

Render stops an idle free service after 15 minutes, and waking takes longer than GitHub's 10-second webhook timeout, so the first webhook after a nap fails, and GitHub does not retry on its own. Two things deal with this:

  • On start-up in production, the server asks GitHub for this App's deliveries from the last hour and requests a redelivery of the failed pull_request ones (GitHub's documented recovery). Redelivering is safe because a commit is only ever reviewed once.
  • The dashboard says "this is taking a while, the server may be waking up" instead of looking broken.

Optional: point a free uptime pinger at /health every 10 minutes to keep the service awake.

Website and dashboard

client/ is a React + Vite + Tailwind app (dark theme) that reads the server's read-only API (GET /api/reviews, /api/reviews/:id, /api/stats, /api/me).

Route What it shows
/ The landing page for visitors (live totals from /api/stats, a real bot comment, features, FAQ). A signed-in user is sent to /dashboard.
/demo The dashboard with the public demo repositories and a "Demo data" banner. A signed-in user is sent to /dashboard (the API scopes data to the user, so it cannot show the demo then).
/dashboard Your own reviews. A visitor who is not signed in is sent to /demo.
/reviews/:id One review's findings.
/privacy The privacy page.
/admin Aggregate usage, for emails on the admins list only.

The dashboard shows totals, reviews per day, issues by severity and category, and a filterable review history. Filters and the page number live in the URL, so a filtered view can be shared. The dashboard pages are loaded on demand, so the landing page does not download the chart library.

Landing page notes:

  • Photos come from Unsplash (free licence) and are listed, with photographer credits, in client/src/content/credits.js (the Unsplash licence does not require on-page credit, so the footer does not show them). The CSP allows images from https://images.unsplash.com only, besides the site itself and GitHub avatars. client/public/hero-preload.js preloads the hero photo on / (an external file, because the CSP forbids inline scripts); a test keeps its URLs in step with the page.
  • Numbers on the page are real: the proof strip is live from /api/stats (skeletons while the API wakes, a plain "unavailable" message if it fails, never a made-up number), and the engineering facts in client/src/content/landing.js record where each came from. Update them when they change.
  • Images in client/public/: dashboard-preview*.webp is a screenshot of the real /demo page, og.png is the 1200×630 social preview.
  • Preview against the live API: API_ORIGIN=https://pr-sentinel-server.onrender.com npm --prefix client run preview serves the production build on http://localhost:4173 with logged-out demo data (sign-in does not work there: the session cookie belongs to the remote host).

Privacy and data handling

The dashboard has a plain-English /privacy page. In short:

  • Sent to the AI: the path and diff of each reviewed file go to Groq, with Google Gemini as the fallback. Private repositories go to Groq only: if Groq fails, the file is reported as not reviewed. Set ALLOW_GEMINI_FOR_PRIVATE_REPOS=true to let private code fall back to Gemini (its free tier may use prompts to improve Google's products; check its terms first).
  • Stored: no diffs or source files. Per review: repository, PR number, title, link, author login, commit SHA, file paths, and the findings. Finding text is written by the model and can quote short pieces of the code. Logs never contain diff content.
  • Retention: each review gets an expiresAt date (REVIEW_RETENTION_DAYS, default 90) and MongoDB deletes it with a TTL index. Reviews saved before this existed are given one at start-up.
  • Delete: uninstalling the App (installation.deleted) deletes every review of that installation; removing a repository (installation_repositories.removed) deletes that repository's reviews. A review still running when this happens is not written back, and a queued job is skipped.

Monitoring

.github/workflows/health-monitor.yml calls /health and opens (or comments on) a GitHub issue titled "AutoReviewer health check failing" when it is down, and closes it when it recovers. /health always answers 200, so the check reads the body: only "status":"ok" passes, "degraded" (database unreachable) fails. It retries for about 50 seconds to ride out a cold start.

Two schedules, pick one by editing the cron line:

  • */10 * * * * (default): also keeps the free Render instance awake, so there is no ~30 s cold start. One always-on service fits in Render's 750 free hours a month.
  • 17 */6 * * *: monitoring only; the instance still sleeps between checks.

Set the target with a repository variable: Settings, Secrets and variables, Actions, Variables, HEALTH_URL (default https://pr-sentinel-server.onrender.com/health). Limits: scheduled runs can start late, and GitHub disables schedules in a repository with no activity for 60 days. Run locally with HEALTH_URL=<url> node server/scripts/check-health.js.

Limits and opt-outs

  • Daily caps (UTC): DAILY_FILES_PER_INSTALLATION (default 10 files) and a global DAILY_GROQ_TOKENS budget (default 180,000 estimated tokens, under Groq's 200,000/day). Counters live in MongoDB and are checked before each file is sent to an LLM, so a PR can be partly reviewed. When a cap stops a review the bot posts one short notice per PR per day.
  • Skip a PR: add the skip-sentinel label or put [skip sentinel] in the title. Draft PRs and PRs opened by bots are skipped too; a draft is reviewed when marked ready for review.
  • Kill switch: set REVIEWS_PAUSED=true on Render. Webhooks are answered 200 ignored and nothing is reviewed; those deliveries count as delivered, so they are not replayed afterwards.

Feedback and admin view

  • Feedback: every inline comment ends with a line asking for a 👍 or 👎 reaction. When a pull request closes, the server lists that PR's review comments once (GitHub includes a reaction summary on each) and stores the 👍/👎 counts per comment. Only counts are stored, never who reacted. Reactions added after the PR closes, or on PRs that are never closed, are not counted.
  • Helpful rate: the dashboard shows 👍 / (👍 + 👎) as "based on N votes", scoped like every other number (you only see votes on repositories you can access).
  • Admin view: admins are the email addresses in the admins MongoDB collection (npm run admin -- list | add <email> | remove <email> in server/). At sign-in the user's verified GitHub emails are checked against it (needs the GitHub App's Email addresses: read account permission); only a matching email is kept on the session, and the list is re-checked on every request, so removing an email takes effect immediately. Admins get GET /api/admin/stats and the /admin page: current and total installations, installations active in the last 14 days, PRs and files reviewed per day, quota used today, and the helpful rate. Aggregates only: no repository names, paths or comment text. Everyone else gets the same 404 as an unknown URL.
  • Installations record: installation webhooks feed an installations collection (account login and type, installed and removed dates). On uninstall the account name is erased and only the dates remain.

What it deliberately does not do

  • It never approves or blocks a PR: it only posts COMMENT reviews.
  • It comments only on lines the PR added, and never on style.
  • It reviews each commit once. A redelivered webhook, or a reopened PR with no new commit, does nothing.

Known limitations

  • Sign-in is new and not yet open to everyone. Signed-in users see only reviews of repositories they can access on GitHub; logged-out visitors see only the public demo repositories (PUBLIC_DEMO_REPOS). Until the launch checklist in docs/LAUNCH_PLAN.md is finished, install the App only on repositories you are happy to have reviewed by free-tier LLMs.
  • A webhook that arrives while the free Render instance is asleep can time out. A cold start takes about 30 seconds (measured), longer than GitHub's 10-second webhook timeout. The start-up redelivery (above) recovers such deliveries, so the review arrives late rather than never. In the App's delivery history (13 deliveries, 2026-11-16) none timed out and none needed a redelivery, but that history never included a webhook sent into a sleeping server, so the recovery path is by design, not observed. A free uptime pinger on /health avoids the cold start altogether.
  • A PR with nothing reviewable gets no comment on GitHub. If every changed file is skipped (lock files, images, build output), the bot stays silent on the PR; the dashboard still records the review with the reason each file was skipped.
  • The review queue is in memory. A restart loses queued jobs; a review that was running is picked up again after 10 minutes if the same commit is redelivered. The fix is a durable queue (BullMQ + Redis), which is not free.
  • Free-tier LLM limits allow roughly three files a minute on Groq, so a large PR takes a few minutes, and at most 10 files per PR are reviewed. A PR that runs past its 4-minute time budget is posted as a partial review.
  • Comments are AI-generated and can be wrong. Each review says so.

The full list, with reasons, is in section 4 of docs/CODE_REVIEW.md.

Project layout

server/   Express API, webhook handler, review pipeline (see docs/PLAN.md section 2)
client/   React dashboard
demo/     sample buggy files for demo PRs
docs/     PLAN.md, CODE_REVIEW.md, LEARNING.md

About

GitHub App that reviews pull requests and shows results in a React dashboard.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages