# madhaveshwar/repolens architecture

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

- Interactive diagram: https://gitdiagram.com/madhaveshwar/repolens
- Repository: https://github.com/madhaveshwar/repolens

## Overview

RepoLens AI connects GitHub repositories to an analysis and review workflow: users select a repository, initiate scans or PR reviews, and inspect findings, scores, trends, and reports in the web app. The backend combines API routes, asynchronous tasks, repository analysis, AI-assisted review, static scanners, and persisted results. The README documents broad capabilities such as test generation, autofixes, and exports; those branches are represented where the tree supports them, but their detailed wiring is not shown in the excerpts.

Main entry points: [`backend/app/tasks/tasks.py`](https://github.com/madhaveshwar/repolens/blob/main/backend/app/tasks/tasks.py) (Background tasks), [`backend/app/services/fast_scan_pipeline.py`](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/fast_scan_pipeline.py) (Repository scan pipeline), [`frontend/src/App.tsx`](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/App.tsx) (Web app), [`backend/app/services/reviewer.py`](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/reviewer.py) (AI PR reviewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_repo_ui["Repository views"]
  node_pr_ui["PR review view<br/>[PRReview.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_repo_state["Repository state<br/>[repositoryStore.ts]"]
  node_analysis_state["Analysis state<br/>[analysisStore.ts]"]
end

subgraph group_backend["API and workflow"]
  node_api["FastAPI routes"]
  node_tasks["Background tasks<br/>[tasks.py]"]
  node_websocket["Progress updates"]
end

subgraph group_analysis["Analysis and review"]
  node_pipeline["Repository scan pipeline"]
  node_reviewer["AI PR reviewer<br/>[reviewer.py]"]
  node_llm["LLM client<br/>[llm_client.py]"]
  node_static_security["Security scanning"]
  node_code_quality["Quality and debt"]
  node_test_generation["Test generation"]
end

subgraph group_data["Persistence and reporting"]
  node_database[("Application database<br/>[database.py]")]
  node_models["Analysis records<br/>[models.py]"]
  node_reports["Report generation"]
end

subgraph group_integrations["External integrations"]
  node_github_service["GitHub access<br/>[github_service.py]"]
  node_github["GitHub"]
  node_llm_provider["LLM providers"]
end

node_user(("Engineer"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_repo_ui
node_webapp -->|"routes to"| node_pr_ui
node_repo_ui -->|"updates"| node_repo_state
node_repo_ui -->|"requests"| node_api_client
node_pr_ui -->|"requests"| node_api_client
node_repo_state -->|"requests"| node_api_client
node_api_client -->|"calls"| node_api
node_api -.->|"queues scans"| node_tasks
node_tasks -->|"persists results"| node_database
node_tasks -->|"uses"| node_github_service
node_pipeline -->|"fetches repository"| node_github_service
node_pipeline -->|"runs scan"| node_static_security
node_pipeline -->|"runs analyses"| node_code_quality
node_pipeline -->|"requests analysis"| node_llm
node_reviewer -->|"requests review"| node_llm
node_reviewer -->|"uses scan"| node_static_security
node_tasks -->|"runs review"| node_reviewer
node_github_service -->|"reads and updates"| node_github
node_llm -->|"calls provider"| node_llm_provider
node_database -->|"stores"| node_models
node_tasks -->|"generates reports"| node_reports
node_reports -->|"exports findings"| node_user
node_webapp -->|"receives progress"| node_websocket
node_websocket -->|"streams progress"| node_user
node_test_generation -.->|"generates tests"| node_llm
node_reviewer -.->|"posts PR comments"| node_github_service

click node_webapp "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/App.tsx"
click node_repo_ui "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/pages/RepositoryDetail.tsx"
click node_pr_ui "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/pages/PRReview.tsx"
click node_api_client "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/lib/api.ts"
click node_repo_state "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/store/repositoryStore.ts"
click node_analysis_state "https://github.com/madhaveshwar/repolens/blob/main/frontend/src/store/analysisStore.ts"
click node_api "https://github.com/madhaveshwar/repolens/tree/main/backend/app/routers"
click node_tasks "https://github.com/madhaveshwar/repolens/blob/main/backend/app/tasks/tasks.py"
click node_pipeline "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/fast_scan_pipeline.py"
click node_reviewer "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/reviewer.py"
click node_llm "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/llm_client.py"
click node_static_security "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/static_security_scanner.py"
click node_code_quality "https://github.com/madhaveshwar/repolens/tree/main/backend/app/services"
click node_test_generation "https://github.com/madhaveshwar/repolens/tree/main/backend/app/services"
click node_github_service "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/github_service.py"
click node_database "https://github.com/madhaveshwar/repolens/blob/main/backend/app/database/database.py"
click node_models "https://github.com/madhaveshwar/repolens/blob/main/backend/app/models/models.py"
click node_reports "https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/report_generator.py"
click node_websocket "https://github.com/madhaveshwar/repolens/blob/main/backend/app/websockets/websocket_manager.py"

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_webapp,node_repo_ui,node_pr_ui,node_api_client,node_repo_state,node_analysis_state toneBlue
class node_api,node_tasks,node_websocket toneAmber
class node_pipeline,node_reviewer,node_llm,node_static_security,node_code_quality,node_test_generation toneMint
class node_database,node_models,node_reports toneRose
class node_github_service,node_github,node_llm_provider,node_user toneIndigo
```

## Components

### Web application

- [Web app](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Repository views](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/pages/RepositoryDetail.tsx): `frontend/src/pages/RepositoryDetail.tsx`
- [PR review view](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/pages/PRReview.tsx): `frontend/src/pages/PRReview.tsx`
- [API client](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Repository state](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/store/repositoryStore.ts): `frontend/src/store/repositoryStore.ts`
- [Analysis state](https://github.com/madhaveshwar/repolens/blob/main/frontend/src/store/analysisStore.ts): `frontend/src/store/analysisStore.ts`

### API and workflow

- [FastAPI routes](https://github.com/madhaveshwar/repolens/tree/main/backend/app/routers): `backend/app/routers`
- [Background tasks](https://github.com/madhaveshwar/repolens/blob/main/backend/app/tasks/tasks.py): `backend/app/tasks/tasks.py`
- [Progress updates](https://github.com/madhaveshwar/repolens/blob/main/backend/app/websockets/websocket_manager.py): `backend/app/websockets/websocket_manager.py`

### Analysis and review

- [Repository scan pipeline](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/fast_scan_pipeline.py): `backend/app/services/fast_scan_pipeline.py`
- [AI PR reviewer](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/reviewer.py): `backend/app/services/reviewer.py`
- [LLM client](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/llm_client.py): `backend/app/services/llm_client.py`
- [Security scanning](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/static_security_scanner.py): `backend/app/services/static_security_scanner.py`
- [Quality and debt](https://github.com/madhaveshwar/repolens/tree/main/backend/app/services): `backend/app/services`
- [Test generation](https://github.com/madhaveshwar/repolens/tree/main/backend/app/services): `backend/app/services`

### Persistence and reporting

- [Application database](https://github.com/madhaveshwar/repolens/blob/main/backend/app/database/database.py): `backend/app/database/database.py`
- [Analysis records](https://github.com/madhaveshwar/repolens/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [Report generation](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/report_generator.py): `backend/app/services/report_generator.py`

### External integrations

- [GitHub access](https://github.com/madhaveshwar/repolens/blob/main/backend/app/services/github_service.py): `backend/app/services/github_service.py`
- **GitHub**
- **LLM providers**

### Other components

- **Engineer**

## Connections

- Engineer → Web app: uses
- Web app → Repository views: routes to (evidence: `frontend/src/App.tsx`)
- Web app → PR review view: routes to (evidence: `frontend/src/App.tsx`)
- Repository views → Repository state: updates (evidence: `frontend/src/pages/RepositoryDetail.tsx`)
- Repository views → API client: requests (evidence: `frontend/src/pages/RepositoryDetail.tsx`)
- PR review view → API client: requests (evidence: `frontend/src/pages/PRReview.tsx`)
- Repository state → API client: requests (evidence: `frontend/src/store/repositoryStore.ts`)
- API client → FastAPI routes: calls
- FastAPI routes → Background tasks: queues scans (evidence: `backend/app/routers/webhooks.py`)
- Background tasks → Application database: persists results (evidence: `backend/app/tasks/tasks.py`)
- Background tasks → GitHub access: uses (evidence: `backend/app/tasks/tasks.py`)
- Repository scan pipeline → GitHub access: fetches repository (evidence: `backend/app/services/fast_scan_pipeline.py`)
- Repository scan pipeline → Security scanning: runs scan (evidence: `backend/app/services/fast_scan_pipeline.py`)
- Repository scan pipeline → Quality and debt: runs analyses (evidence: `backend/app/services/fast_scan_pipeline.py`)
- Repository scan pipeline → LLM client: requests analysis (evidence: `backend/app/services/fast_scan_pipeline.py`)
- AI PR reviewer → LLM client: requests review (evidence: `backend/app/services/reviewer.py`)
- AI PR reviewer → Security scanning: uses scan (evidence: `backend/app/services/reviewer.py`)
- Background tasks → AI PR reviewer: runs review (evidence: `backend/app/tasks/tasks.py`)
- GitHub access → GitHub: reads and updates
- LLM client → LLM providers: calls provider
- Application database → Analysis records: stores (evidence: `backend/app/models/models.py`)
- Background tasks → Report generation: generates reports (evidence: `backend/app/tasks/tasks.py`)
- Report generation → Engineer: exports findings
- Web app → Progress updates: receives progress
- Progress updates → Engineer: streams progress
- Test generation → LLM client: generates tests (evidence: `backend/app/services/fast_scan_pipeline.py`)
- AI PR reviewer → GitHub access: posts PR comments
