# skyy-prog/reviewpilot architecture

> Architecture diagram of the GitHub repository skyy-prog/reviewpilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skyy-prog/reviewpilot
- Repository: https://github.com/skyy-prog/reviewpilot

## Overview

ReviewPilot turns GitHub pull-request webhooks into queued LLM reviews, posts findings back to GitHub, and exposes review history, statistics, and feedback in an authenticated dashboard. The graph follows the documented webhook-to-worker flow and the sampled calls between worker, integrations, and storage. Some dashboard-to-server wiring is documented in the README; unsampled implementation details are not inferred beyond that.

Main entry points: [`backend/src/worker.ts`](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/worker.ts) (Review worker), [`backend/src/server.ts`](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/server.ts) (Express server), [`backend/src/config.ts`](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/config.ts) (Runtime config), [`backend/src/github.ts`](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/github.ts) (GitHub client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Webhook and API"]
  node_server["Express server<br/>[server.ts]"]
  node_auth["Session auth<br/>[auth.ts]"]
  node_api["Dashboard API<br/>[api.ts]"]
end

subgraph group_review["Review processing"]
  node_worker["Review worker<br/>[worker.ts]"]
  node_diff["Diff filtering<br/>[diff.ts]"]
  node_github_integration["GitHub client<br/>[github.ts]"]
  node_llm["Gemini review<br/>[llm.ts]"]
  node_notify["Telegram notify<br/>[notify.ts]"]
  node_config["Runtime config<br/>[config.ts]"]
end

subgraph group_storage["Review data"]
  node_db_client["Postgres client<br/>[db.ts]"]
  node_database[("Review database<br/>[db.ts]")]
end

subgraph group_dashboard["Dashboard"]
  node_app["Dashboard UI<br/>[App.tsx]"]
  node_frontend_api["Dashboard API client<br/>[api.ts]"]
end

node_github_user(("GitHub"))
node_dashboard_user(("Dashboard user"))
node_gemini_service{{"Gemini API"}}
node_telegram_service{{"Telegram"}}

node_github_user -->|"sends webhook"| node_server
node_server -->|"queues jobs"| node_database
node_server -->|"mounts routes"| node_auth
node_server -->|"mounts API"| node_api
node_worker -->|"claims jobs"| node_database
node_worker -->|"fetches PR data"| node_github_integration
node_worker -->|"reads repo config"| node_github_integration
node_worker -->|"filters and annotates"| node_diff
node_worker -->|"requests review"| node_llm
node_llm -->|"calls API"| node_gemini_service
node_worker -->|"posts review"| node_github_integration
node_worker -->|"stores findings"| node_database
node_worker -->|"sends summary"| node_notify
node_notify -->|"sends message"| node_telegram_service
node_dashboard_user -->|"uses dashboard"| node_app
node_app -->|"requests dashboard data"| node_frontend_api
node_frontend_api -->|"calls /api"| node_server
node_api -->|"queries and updates"| node_database
node_server -->|"loads settings"| node_config
node_worker -->|"uses settings"| node_config
node_github_integration -->|"uses credentials"| node_config
node_llm -->|"uses model settings"| node_config
node_auth -->|"uses session settings"| node_config
node_db_client -->|"uses database URL"| node_config

click node_server "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/server.ts"
click node_auth "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/auth.ts"
click node_api "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/api.ts"
click node_worker "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/worker.ts"
click node_diff "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/diff.ts"
click node_github_integration "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/github.ts"
click node_llm "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/llm.ts"
click node_notify "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/notify.ts"
click node_config "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/config.ts"
click node_db_client "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/db.ts"
click node_database "https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/db.ts"
click node_app "https://github.com/skyy-prog/reviewpilot/blob/main/frontend/src/App.tsx"
click node_frontend_api "https://github.com/skyy-prog/reviewpilot/blob/main/frontend/src/api.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_auth,node_api,node_dashboard_user toneBlue
class node_worker,node_diff,node_github_integration,node_llm,node_notify,node_config toneAmber
class node_db_client,node_database,node_gemini_service toneMint
class node_app,node_frontend_api toneRose
class node_github_user,node_telegram_service toneIndigo
```

## Components

### Webhook and API

- [Express server](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Session auth](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/auth.ts): `backend/src/auth.ts`
- [Dashboard API](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/api.ts): `backend/src/api.ts`

### Review processing

- [Review worker](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/worker.ts): `backend/src/worker.ts`
- [Diff filtering](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/diff.ts): `backend/src/diff.ts`
- [GitHub client](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/github.ts): `backend/src/github.ts`
- [Gemini review](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/llm.ts): `backend/src/llm.ts`
- [Telegram notify](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/notify.ts): `backend/src/notify.ts`
- [Runtime config](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/config.ts): `backend/src/config.ts`

### Review data

- [Postgres client](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/db.ts): `backend/src/db.ts`
- [Review database](https://github.com/skyy-prog/reviewpilot/blob/main/backend/src/db.ts): `backend/src/db.ts`

### Dashboard

- [Dashboard UI](https://github.com/skyy-prog/reviewpilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard API client](https://github.com/skyy-prog/reviewpilot/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Other components

- **GitHub**
- **Dashboard user**
- **Gemini API**
- **Telegram**

## Connections

- GitHub → Express server: sends webhook (evidence: `README.md`)
- Express server → Review database: queues jobs (evidence: `backend/src/server.ts`)
- Express server → Session auth: mounts routes (evidence: `backend/src/server.ts`)
- Express server → Dashboard API: mounts API (evidence: `backend/src/server.ts`)
- Review worker → Review database: claims jobs (evidence: `backend/src/worker.ts`)
- Review worker → GitHub client: fetches PR data (evidence: `backend/src/worker.ts`)
- Review worker → GitHub client: reads repo config (evidence: `backend/src/worker.ts`)
- Review worker → Diff filtering: filters and annotates (evidence: `backend/src/worker.ts`)
- Review worker → Gemini review: requests review (evidence: `backend/src/worker.ts`)
- Gemini review → Gemini API: calls API (evidence: `backend/src/llm.ts`)
- Review worker → GitHub client: posts review (evidence: `backend/src/worker.ts`)
- Review worker → Review database: stores findings (evidence: `backend/src/worker.ts`)
- Review worker → Telegram notify: sends summary (evidence: `backend/src/worker.ts`)
- Telegram notify → Telegram: sends message (evidence: `backend/src/notify.ts`)
- Dashboard user → Dashboard UI: uses dashboard (evidence: `README.md`)
- Dashboard UI → Dashboard API client: requests dashboard data (evidence: `frontend/src/App.tsx`)
- Dashboard API client → Express server: calls /api (evidence: `README.md`)
- Dashboard API → Review database: queries and updates (evidence: `backend/src/api.ts`)
- Express server → Runtime config: loads settings (evidence: `backend/src/server.ts`)
- Review worker → Runtime config: uses settings (evidence: `backend/src/worker.ts`)
- GitHub client → Runtime config: uses credentials (evidence: `backend/src/github.ts`)
- Gemini review → Runtime config: uses model settings (evidence: `backend/src/llm.ts`)
- Session auth → Runtime config: uses session settings (evidence: `backend/src/auth.ts`)
- Postgres client → Runtime config: uses database URL (evidence: `backend/src/db.ts`)
