# gopi-yenduru/ai-code-review-agent-system architecture

> Architecture diagram of the GitHub repository gopi-yenduru/ai-code-review-agent-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gopi-yenduru/ai-code-review-agent-system
- Repository: https://github.com/gopi-yenduru/ai-code-review-agent-system

## Overview

AI Code Review Agent reviews GitHub pull requests through a webhook-triggered, parallel three-agent analysis, persists findings and developer statistics, and presents review history and analytics in a React dashboard. The graph preserves the documented security, performance, quality, risk-scoring, GitHub-comment, review-detail, and analytics capabilities. Source excerpts verify the webhook orchestration and persistence path; README documentation supports the broader product flow where implementation details were not sampled.

Main entry points: [`frontend/src/api/client.js`](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/api/client.js) (API Client), [`backend/routers/webhook.py`](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/webhook.py) (Webhook Router), [`backend/services/review_service.py`](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/review_service.py) (Review Orchestrator), [`backend/agents/graph.py`](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/graph.py) (Agent Graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["PR Intake"]
  node_webhook["Webhook Router<br/>[webhook.py]"]
  node_github_service["GitHub Service<br/>[github_service.py]"]
  node_review_service["Review Orchestrator<br/>[review_service.py]"]
end

subgraph group_analysis["AI Review"]
  node_pipeline["Agent Graph<br/>[graph.py]"]
  node_security["Security Auditor<br/>[security_agent.py]"]
  node_performance["Performance Analyst"]
  node_quality["Quality Judge<br/>[quality_agent.py]"]
end

subgraph group_persistence["Review Data"]
  node_review_api["Reviews Router<br/>[reviews.py]"]
  node_analytics_api["Analytics Router<br/>[analytics.py]"]
  node_analytics["Analytics Service"]
  node_review_models[("Review and Issue Models<br/>[review.py]")]
  node_developer_model[("Developer Model<br/>[user.py]")]
  node_database[("PostgreSQL<br/>[database.py]")]
end

subgraph group_dashboard["Dashboard"]
  node_frontend["React App<br/>[App.jsx]"]
  node_dashboard_page["Overview Dashboard<br/>[Dashboard.jsx]"]
  node_review_detail["Review Detail<br/>[ReviewDetail.jsx]"]
  node_developer_stats["Developer Stats<br/>[DeveloperStats.jsx]"]
  node_api_client["API Client<br/>[client.js]"]
  node_risk_card["Risk Score Card<br/>[RiskScoreCard.jsx]"]
  node_agent_panel["Agent Result Panel"]
end

node_github(("GitHub"))
node_gemini(("Google Gemini"))
node_developer(("Developer"))

node_github -->|"sends events"| node_webhook
node_webhook -->|"verifies and fetches"| node_github_service
node_webhook -->|"starts review"| node_review_service
node_webhook -->|"posts comment"| node_github_service
node_review_service -->|"runs pipeline"| node_pipeline
node_pipeline -->|"dispatches"| node_security
node_pipeline -->|"dispatches"| node_performance
node_pipeline -->|"dispatches"| node_quality
node_security -->|"analyzes diff"| node_gemini
node_performance -->|"analyzes diff"| node_gemini
node_quality -->|"analyzes diff"| node_gemini
node_review_service -->|"saves findings"| node_review_models
node_review_service -->|"updates statistics"| node_developer_model
node_review_models -->|"stored in"| node_database
node_developer_model -->|"stored in"| node_database
node_github_service -->|"fetches diff and comments"| node_github
node_developer -->|"uses dashboard"| node_frontend
node_frontend -->|"routes to"| node_dashboard_page
node_frontend -->|"routes to"| node_review_detail
node_frontend -->|"routes to"| node_developer_stats
node_dashboard_page -->|"requests stats"| node_api_client
node_review_detail -->|"loads review"| node_api_client
node_developer_stats -->|"loads analytics"| node_api_client
node_api_client -->|"requests reviews"| node_review_api
node_api_client -->|"requests analytics"| node_analytics_api
node_analytics_api -->|"delegates queries"| node_analytics
node_analytics -->|"reads reviews"| node_review_models
node_analytics -->|"reads developers"| node_developer_model
node_review_detail -->|"renders score"| node_risk_card
node_review_detail -->|"renders results"| node_agent_panel

click node_webhook "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/webhook.py"
click node_github_service "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/github_service.py"
click node_review_service "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/review_service.py"
click node_pipeline "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/graph.py"
click node_security "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/security_agent.py"
click node_performance "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/performance_agent.py"
click node_quality "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/quality_agent.py"
click node_review_api "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/reviews.py"
click node_analytics_api "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/analytics.py"
click node_analytics "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/analytics_service.py"
click node_review_models "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/models/review.py"
click node_developer_model "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/models/user.py"
click node_database "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/database.py"
click node_frontend "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/App.jsx"
click node_dashboard_page "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/Dashboard.jsx"
click node_review_detail "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/ReviewDetail.jsx"
click node_developer_stats "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/DeveloperStats.jsx"
click node_api_client "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/api/client.js"
click node_risk_card "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/components/RiskScoreCard.jsx"
click node_agent_panel "https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/components/AgentResultPanel.jsx"

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_webhook,node_github_service,node_review_service toneBlue
class node_pipeline,node_security,node_performance,node_quality toneAmber
class node_review_api,node_analytics_api,node_analytics,node_review_models,node_developer_model,node_database toneMint
class node_frontend,node_dashboard_page,node_review_detail,node_developer_stats,node_api_client,node_risk_card,node_agent_panel toneRose
class node_github,node_gemini,node_developer toneIndigo
```

## Components

### PR Intake

- [Webhook Router](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/webhook.py): `backend/routers/webhook.py`
- [GitHub Service](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/github_service.py): `backend/services/github_service.py`
- [Review Orchestrator](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/review_service.py): `backend/services/review_service.py`

### AI Review

- [Agent Graph](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/graph.py): `backend/agents/graph.py`
- [Security Auditor](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/security_agent.py): `backend/agents/security_agent.py`
- [Performance Analyst](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/performance_agent.py): `backend/agents/performance_agent.py`
- [Quality Judge](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/agents/quality_agent.py): `backend/agents/quality_agent.py`

### Review Data

- [Reviews Router](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/reviews.py): `backend/routers/reviews.py`
- [Analytics Router](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/routers/analytics.py): `backend/routers/analytics.py`
- [Analytics Service](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/services/analytics_service.py): `backend/services/analytics_service.py`
- [Review and Issue Models](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/models/review.py): `backend/models/review.py`
- [Developer Model](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/models/user.py): `backend/models/user.py`
- [PostgreSQL](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/backend/database.py): `backend/database.py`

### Dashboard

- [React App](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Overview Dashboard](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Review Detail](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/ReviewDetail.jsx): `frontend/src/pages/ReviewDetail.jsx`
- [Developer Stats](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/pages/DeveloperStats.jsx): `frontend/src/pages/DeveloperStats.jsx`
- [API Client](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Risk Score Card](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/components/RiskScoreCard.jsx): `frontend/src/components/RiskScoreCard.jsx`
- [Agent Result Panel](https://github.com/gopi-yenduru/ai-code-review-agent-system/blob/main/frontend/src/components/AgentResultPanel.jsx): `frontend/src/components/AgentResultPanel.jsx`

### Other components

- **GitHub**
- **Google Gemini**
- **Developer**

## Connections

- GitHub → Webhook Router: sends events (evidence: `README.md`)
- Webhook Router → GitHub Service: verifies and fetches (evidence: `backend/routers/webhook.py`)
- Webhook Router → Review Orchestrator: starts review (evidence: `backend/routers/webhook.py`)
- Webhook Router → GitHub Service: posts comment (evidence: `backend/routers/webhook.py`)
- Review Orchestrator → Agent Graph: runs pipeline (evidence: `backend/services/review_service.py`)
- Agent Graph → Security Auditor: dispatches (evidence: `backend/agents/graph.py`)
- Agent Graph → Performance Analyst: dispatches (evidence: `backend/agents/graph.py`)
- Agent Graph → Quality Judge: dispatches (evidence: `backend/agents/graph.py`)
- Security Auditor → Google Gemini: analyzes diff (evidence: `README.md`)
- Performance Analyst → Google Gemini: analyzes diff (evidence: `README.md`)
- Quality Judge → Google Gemini: analyzes diff (evidence: `README.md`)
- Review Orchestrator → Review and Issue Models: saves findings (evidence: `backend/services/review_service.py`)
- Review Orchestrator → Developer Model: updates statistics (evidence: `backend/services/review_service.py`)
- Review and Issue Models → PostgreSQL: stored in (evidence: `backend/models/review.py`)
- Developer Model → PostgreSQL: stored in (evidence: `backend/models/user.py`)
- GitHub Service → GitHub: fetches diff and comments (evidence: `README.md`)
- Developer → React App: uses dashboard (evidence: `README.md`)
- React App → Overview Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React App → Review Detail: routes to (evidence: `frontend/src/App.jsx`)
- React App → Developer Stats: routes to (evidence: `frontend/src/App.jsx`)
- Overview Dashboard → API Client: requests stats (evidence: `frontend/src/pages/Dashboard.jsx`)
- Review Detail → API Client: loads review (evidence: `frontend/src/pages/ReviewDetail.jsx`)
- Developer Stats → API Client: loads analytics (evidence: `frontend/src/pages/DeveloperStats.jsx`)
- API Client → Reviews Router: requests reviews (evidence: `README.md`)
- API Client → Analytics Router: requests analytics (evidence: `README.md`)
- Analytics Router → Analytics Service: delegates queries (evidence: `backend/routers/analytics.py`)
- Analytics Service → Review and Issue Models: reads reviews (evidence: `backend/services/analytics_service.py`)
- Analytics Service → Developer Model: reads developers (evidence: `backend/services/analytics_service.py`)
- Review Detail → Risk Score Card: renders score (evidence: `frontend/src/pages/ReviewDetail.jsx`)
- Review Detail → Agent Result Panel: renders results (evidence: `frontend/src/pages/ReviewDetail.jsx`)
