Skip to content

About

A GitHub App that reviews pull requests with Claude. NestJS + BullMQ, multi-persona reviews, incremental re-reviews, and cost guardrails.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

63 Commits

Folders and files

Repository files navigation

ai-code-review-bot

A NestJS service that reviews GitHub pull requests with Claude. A GitHub App webhook fires on PR activity, the work is queued, and a background worker runs a chunked, multi-persona review through Claude and posts inline comments back to the PR — under per-installation cost guardrails, with every review persisted to Postgres.

flowchart LR
    GH[GitHub PR event] -->|webhook| WH[Webhook controller]
    WH -->|pr.review.requested| Q[(BullMQ / Redis)]
    Q --> W[Review worker]
    W --> GR{Guardrails}
    W --> ENG[Review engine] --> CL[Claude]
    W --> POST[Post review to GitHub]
    W --> DB[(Postgres)]
Loading
  • Hot path (webhook): verify signature, dedupe delivery, enqueue — and nothing else.
  • Cold path (worker): budget checks, PR fetch, chunking, the Claude calls, posting, persistence.
  • Every review is cost-guarded and idempotent (the same head SHA is never reviewed twice).

Tech stack

Concern Choice
Runtime Node.js ≥22, TypeScript 5
Framework NestJS 11 (Express)
Queue BullMQ on Redis
Datastore Postgres via Prisma 6
Cache / counters Redis (ioredis)
LLM Anthropic Claude (@anthropic-ai/sdk) with prompt caching
GitHub GitHub App auth via @octokit/rest + @octokit/auth-app
Logging / metrics nestjs-pino (JSON) + Prometheus
Tests Jest (unit) + testcontainers (integration/e2e)

Quick start

cp .env.example .env          # fill in GitHub App + Anthropic credentials
make dev                      # docker compose: app + redis + postgres, tails app logs

The HTTP server and the BullMQ worker run in the same process (scale by running more replicas of the image). See docs/runbooks/local-development.md for running against host Node with containerized Redis/Postgres.

Common commands

Command What it does
npm run start:dev Run with watch mode (needs Redis + Postgres reachable)
npm test Unit tests (DB-free, 80% coverage gate)
npm run test:integration Integration tests against throwaway containers
npm run lint / npm run format ESLint / Prettier
npm run db:migrate:dev Create + apply a Prisma migration
npm run config:print Print the validated config (secrets masked)
make dev / make down / make nuke Bring the Docker stack up / down / down+wipe volumes

Configuration

All config is environment-driven and validated at boot (fail-fast) by src/config/env.validation.ts. Required: DATABASE_URL, GITHUB_WEBHOOK_SECRET, GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, ANTHROPIC_API_KEY. See .env.example for the full annotated list and docs/backend/configuration.md for details.

Documentation

Full documentation lives in docs/:

  • Architecture — end-to-end flow and the event taxonomy. Start here.
  • Directory structure — annotated map of the repo.
  • Backend — the service internals, module by module.
  • Database — Postgres schema, ER diagram, repositories.
  • Middleware — the HTTP request-path cross-cutting layer.
  • Runbooks — local dev, deploy, cost, queue ops, incidents.

Working in this repo with Claude Code? See CLAUDE.md.

Contributing

Contributions are welcome — see CONTRIBUTING.md for the local setup and conventions, and SECURITY.md for reporting vulnerabilities.

License

Released under the MIT License.

About

A GitHub App that reviews pull requests with Claude. NestJS + BullMQ, multi-persona reviews, incremental re-reviews, and cost guardrails.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages