# aditya-g25/reviewpilot architecture

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

- Interactive diagram: https://gitdiagram.com/aditya-g25/reviewpilot
- Repository: https://github.com/aditya-g25/reviewpilot

## Overview

ReviewPilot AI is a Python-first code-review and test-generation platform. A reviewer submits a GitHub pull request or source file through the frontend; the backend ingests it, inspects Python code, triages findings with an SLM, selectively escalates findings to an LLM, generates pytest cases, validates them in a sandbox, and stores a human-review report. The UI also exposes findings, routing, test validation, history, repositories, analytics, benchmarks, and settings. The README documents the workflow; some backend wiring and frontend API behavior are unsampled, so those links are omitted or marked unverified.

Main entry points: [`backend/services/hybrid_engine.py`](https://github.com/aditya-g25/reviewpilot/blob/main/backend/services/hybrid_engine.py) (Review Orchestrator), [`frontend/src/App.tsx`](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/App.tsx) (Review App), [`frontend/src/pages/NewReviewPage.tsx`](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/NewReviewPage.tsx) (New Review), [`frontend/src/pages/CodeReviewResultsPage.tsx`](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/CodeReviewResultsPage.tsx) (Review Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Submission &amp; UI"]
  node_new_review_ui["New Review<br/>[NewReviewPage.tsx]"]
  node_review_app["Review App<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
  node_review_results["Review Results"]
  node_overview["Overview<br/>[OverviewPage.tsx]"]
  node_repositories["Repositories"]
  node_history["Review History"]
  node_findings["Findings<br/>[FindingsPage.tsx]"]
  node_routing_view["Routing View"]
  node_test_validation_view["Test Validation"]
  node_benchmark["Benchmarks<br/>[BenchmarkPage.tsx]"]
  node_landing["Landing Page<br/>[LandingPage.tsx]"]
  node_ui_primitives["UI Primitives<br/>[Primitives.tsx]"]
  node_code_view["Python Code View"]
end

subgraph group_analysis["Review Analysis"]
  node_pr_ingestion["PR Ingestion<br/>[ingestion.py]"]
  node_github_client["GitHub Access<br/>[github_client.py]"]
  node_review_engine["Review Orchestrator<br/>[hybrid_engine.py]"]
  node_static_analysis["Static Analysis<br/>[static_analysis.py]"]
  node_ast_parser["AST Inspection<br/>[ast_parser.py]"]
  node_file_extractor["File Extraction<br/>[file_extractor.py]"]
  node_slm_triage["SLM Triage<br/>[slm_client.py]"]
  node_routing_engine["Escalation Routing<br/>[routing_engine.py]"]
  node_llm_reasoning["LLM Reasoning<br/>[llm_client.py]"]
end

subgraph group_validation["Tests &amp; Reporting"]
  node_test_generator["Pytest Generation<br/>[test_generator.py]"]
  node_sandbox["Sandbox Validation<br/>[sandbox_runner.py]"]
  node_report_generator["Report Generation"]
end

subgraph group_state["Persistence &amp; Contracts"]
  node_api_server["Backend API<br/>[main.py]"]
  node_schemas["Review Contracts<br/>[schemas.py]"]
  node_database[("SQLite Store<br/>[database.py]")]
  node_ui_types["UI Contracts<br/>[reviewpilot.ts]"]
  node_demo_data["Demo Records<br/>[demoData.ts]"]
end

node_reviewer(("Reviewer"))
node_llm_provider(("LLM Provider"))

node_reviewer -->|"submits review"| node_new_review_ui
node_new_review_ui -->|"fetches PR detail"| node_api_client
node_review_app -->|"routes to"| node_new_review_ui
node_review_app -->|"routes to"| node_overview
node_review_app -->|"routes to"| node_repositories
node_review_app -->|"routes to"| node_history
node_review_app -->|"routes to"| node_findings
node_review_app -->|"routes to"| node_routing_view
node_review_app -->|"routes to"| node_test_validation_view
node_review_app -->|"routes to"| node_benchmark
node_review_app -->|"routes to"| node_landing
node_review_app -->|"saves settings"| node_api_client
node_review_app -->|"loads demo records"| node_demo_data
node_new_review_ui -.->|"submits analysis"| node_review_engine
node_api_server -.->|"dispatches review"| node_review_engine
node_review_engine -->|"ingests request"| node_pr_ingestion
node_review_engine -->|"runs analyzers"| node_static_analysis
node_review_engine -->|"inspects syntax"| node_ast_parser
node_review_engine -->|"extracts targets"| node_file_extractor
node_review_engine -->|"triages findings"| node_slm_triage
node_review_engine -->|"routes findings"| node_routing_engine
node_review_engine -->|"escalates findings"| node_llm_reasoning
node_llm_reasoning -->|"requests reasoning"| node_llm_provider
node_review_engine -->|"generates tests"| node_test_generator
node_review_engine -->|"validates tests"| node_sandbox
node_review_engine -->|"builds report"| node_report_generator
node_review_engine -->|"writes review data"| node_database
node_github_client -->|"stores auth"| node_database
node_new_review_ui -.->|"requests PR files"| node_github_client
node_review_app -->|"shows report"| node_review_results
node_review_results -->|"renders controls"| node_ui_primitives
node_review_results -->|"renders snippets"| node_code_view
node_routing_view -->|"renders controls"| node_ui_primitives
node_new_review_ui -->|"renders controls"| node_ui_primitives
node_new_review_ui -->|"renders examples"| node_code_view
node_review_engine -->|"creates review models"| node_schemas

click node_new_review_ui "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/NewReviewPage.tsx"
click node_review_app "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/services/api.ts"
click node_review_results "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/CodeReviewResultsPage.tsx"
click node_overview "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/OverviewPage.tsx"
click node_repositories "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/RepositoriesPage.tsx"
click node_history "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/ReviewHistoryPage.tsx"
click node_findings "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/FindingsPage.tsx"
click node_routing_view "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/RoutingVisualizationPage.tsx"
click node_test_validation_view "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/TestValidationPage.tsx"
click node_benchmark "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/BenchmarkPage.tsx"
click node_landing "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/LandingPage.tsx"
click node_pr_ingestion "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/ingestion.py"
click node_github_client "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/github_client.py"
click node_review_engine "https://github.com/aditya-g25/reviewpilot/blob/main/backend/services/hybrid_engine.py"
click node_static_analysis "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/static_analysis.py"
click node_ast_parser "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/ast_parser.py"
click node_file_extractor "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/file_extractor.py"
click node_slm_triage "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/slm_client.py"
click node_routing_engine "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/routing_engine.py"
click node_llm_reasoning "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/llm_client.py"
click node_test_generator "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/test_generator.py"
click node_sandbox "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/sandbox_runner.py"
click node_report_generator "https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/report_generator.py"
click node_api_server "https://github.com/aditya-g25/reviewpilot/blob/main/backend/main.py"
click node_schemas "https://github.com/aditya-g25/reviewpilot/blob/main/backend/models/schemas.py"
click node_database "https://github.com/aditya-g25/reviewpilot/blob/main/backend/db/database.py"
click node_ui_types "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/types/reviewpilot.ts"
click node_demo_data "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/data/demoData.ts"
click node_ui_primitives "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/components/ui/Primitives.tsx"
click node_code_view "https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/components/ui/PythonCodeBlock.tsx"

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_new_review_ui,node_review_app,node_api_client,node_review_results,node_overview,node_repositories,node_history,node_findings,node_routing_view,node_test_validation_view,node_benchmark,node_landing,node_ui_primitives,node_code_view,node_reviewer toneBlue
class node_pr_ingestion,node_github_client,node_review_engine,node_static_analysis,node_ast_parser,node_file_extractor,node_slm_triage,node_routing_engine,node_llm_reasoning toneAmber
class node_test_generator,node_sandbox,node_report_generator toneMint
class node_api_server,node_schemas,node_database,node_ui_types,node_demo_data toneRose
class node_llm_provider toneIndigo
```

## Components

### Submission & UI

- [New Review](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/NewReviewPage.tsx): `frontend/src/pages/NewReviewPage.tsx`
- [Review App](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Review Results](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/CodeReviewResultsPage.tsx): `frontend/src/pages/CodeReviewResultsPage.tsx`
- [Overview](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/OverviewPage.tsx): `frontend/src/pages/OverviewPage.tsx`
- [Repositories](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/RepositoriesPage.tsx): `frontend/src/pages/RepositoriesPage.tsx`
- [Review History](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/ReviewHistoryPage.tsx): `frontend/src/pages/ReviewHistoryPage.tsx`
- [Findings](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/FindingsPage.tsx): `frontend/src/pages/FindingsPage.tsx`
- [Routing View](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/RoutingVisualizationPage.tsx): `frontend/src/pages/RoutingVisualizationPage.tsx`
- [Test Validation](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/TestValidationPage.tsx): `frontend/src/pages/TestValidationPage.tsx`
- [Benchmarks](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/BenchmarkPage.tsx): `frontend/src/pages/BenchmarkPage.tsx`
- [Landing Page](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/pages/LandingPage.tsx): `frontend/src/pages/LandingPage.tsx`
- [UI Primitives](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/components/ui/Primitives.tsx): `frontend/src/components/ui/Primitives.tsx`
- [Python Code View](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/components/ui/PythonCodeBlock.tsx): `frontend/src/components/ui/PythonCodeBlock.tsx`

### Review Analysis

- [PR Ingestion](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/ingestion.py): `backend/modules/ingestion.py`
- [GitHub Access](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/github_client.py): `backend/modules/github_client.py`
- [Review Orchestrator](https://github.com/aditya-g25/reviewpilot/blob/main/backend/services/hybrid_engine.py): `backend/services/hybrid_engine.py`
- [Static Analysis](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/static_analysis.py): `backend/modules/static_analysis.py`
- [AST Inspection](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/ast_parser.py): `backend/modules/ast_parser.py`
- [File Extraction](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/file_extractor.py): `backend/modules/file_extractor.py`
- [SLM Triage](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/slm_client.py): `backend/modules/slm_client.py`
- [Escalation Routing](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/routing_engine.py): `backend/modules/routing_engine.py`
- [LLM Reasoning](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/llm_client.py): `backend/modules/llm_client.py`

### Tests & Reporting

- [Pytest Generation](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/test_generator.py): `backend/modules/test_generator.py`
- [Sandbox Validation](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/sandbox_runner.py): `backend/modules/sandbox_runner.py`
- [Report Generation](https://github.com/aditya-g25/reviewpilot/blob/main/backend/modules/report_generator.py): `backend/modules/report_generator.py`

### Persistence & Contracts

- [Backend API](https://github.com/aditya-g25/reviewpilot/blob/main/backend/main.py): `backend/main.py`
- [Review Contracts](https://github.com/aditya-g25/reviewpilot/blob/main/backend/models/schemas.py): `backend/models/schemas.py`
- [SQLite Store](https://github.com/aditya-g25/reviewpilot/blob/main/backend/db/database.py): `backend/db/database.py`
- [UI Contracts](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/types/reviewpilot.ts): `frontend/src/types/reviewpilot.ts`
- [Demo Records](https://github.com/aditya-g25/reviewpilot/blob/main/frontend/src/data/demoData.ts): `frontend/src/data/demoData.ts`

### Other components

- **Reviewer**
- **LLM Provider**

## Connections

- Reviewer → New Review: submits review
- New Review → API Client: fetches PR detail (evidence: `frontend/src/pages/NewReviewPage.tsx`)
- Review App → New Review: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Overview: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Repositories: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Review History: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Findings: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Routing View: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Test Validation: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Benchmarks: routes to (evidence: `frontend/src/App.tsx`)
- Review App → Landing Page: routes to (evidence: `frontend/src/App.tsx`)
- Review App → API Client: saves settings (evidence: `frontend/src/App.tsx`)
- Review App → Demo Records: loads demo records (evidence: `frontend/src/App.tsx`)
- New Review → Review Orchestrator: submits analysis
- Backend API → Review Orchestrator: dispatches review
- Review Orchestrator → PR Ingestion: ingests request (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → Static Analysis: runs analyzers (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → AST Inspection: inspects syntax (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → File Extraction: extracts targets (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → SLM Triage: triages findings (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → Escalation Routing: routes findings (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → LLM Reasoning: escalates findings (evidence: `backend/services/hybrid_engine.py`)
- LLM Reasoning → LLM Provider: requests reasoning (evidence: `backend/modules/llm_client.py`)
- Review Orchestrator → Pytest Generation: generates tests (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → Sandbox Validation: validates tests (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → Report Generation: builds report (evidence: `backend/services/hybrid_engine.py`)
- Review Orchestrator → SQLite Store: writes review data (evidence: `backend/services/hybrid_engine.py`)
- GitHub Access → SQLite Store: stores auth (evidence: `backend/modules/github_client.py`)
- New Review → GitHub Access: requests PR files
- Review App → Review Results: shows report (evidence: `frontend/src/App.tsx`)
- Review Results → UI Primitives: renders controls (evidence: `frontend/src/pages/CodeReviewResultsPage.tsx`)
- Review Results → Python Code View: renders snippets (evidence: `frontend/src/pages/CodeReviewResultsPage.tsx`)
- Routing View → UI Primitives: renders controls (evidence: `frontend/src/pages/RoutingVisualizationPage.tsx`)
- New Review → UI Primitives: renders controls (evidence: `frontend/src/pages/NewReviewPage.tsx`)
- New Review → Python Code View: renders examples (evidence: `frontend/src/pages/NewReviewPage.tsx`)
- Review Orchestrator → Review Contracts: creates review models (evidence: `backend/services/hybrid_engine.py`)
