# rohithbhagath/codesentinel architecture

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

- Interactive diagram: https://gitdiagram.com/rohithbhagath/codesentinel
- Repository: https://github.com/rohithbhagath/codesentinel

## Overview

CodeSentinel automates pull-request reviews: GitHub/GitLab webhooks and manual API requests create review jobs, a Celery worker runs the LangGraph review workflow, and the product exposes findings and summaries through its API and React dashboard. The documented review stages include PR ingestion, planning, specialist-agent analysis, synthesis, and provider feedback; static analysis runs tools in a Docker sandbox. The graph preserves these documented capabilities, but several workflow modules were not sampled, so their internal call relationships are not asserted.

Main entry points: [`backend/app/agents/orchestrator.py`](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/agents/orchestrator.py) (Workflow orchestrator), [`backend/main.py`](https://github.com/rohithbhagath/codesentinel/blob/main/backend/main.py) (FastAPI app), [`backend/app/api/v1/reviews.py`](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/api/v1/reviews.py) (REST API), [`backend/app/static_analysis/pipeline.py`](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/static_analysis/pipeline.py) (Static analysis pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Ingress and API"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_api_routes["REST API<br/>[reviews.py]"]
  node_metrics["Prometheus metrics<br/>[metrics.py]"]
end

subgraph group_review["Review workflow"]
  node_job_worker["Celery worker<br/>[celery_worker.py]"]
  node_orchestrator["Workflow orchestrator<br/>[orchestrator.py]"]
  node_pr_ingestion["PR ingestion"]
  node_review_planner["Review planning"]
  node_specialists["Specialist agents"]
end

subgraph group_analysis["Analysis engines"]
  node_llm["LLM review engine"]
  node_static_pipeline["Static analysis pipeline<br/>[pipeline.py]"]
  node_sandbox["Docker sandbox<br/>[docker_sandbox.py]"]
  node_tool_runners["Static tool runners"]
end

subgraph group_data["Persistence and integrations"]
  node_webhooks["Provider webhooks<br/>[webhooks.py]"]
  node_database[("Application database<br/>[session.py]")]
  node_provider_clients["Provider clients"]
end

subgraph group_ui["Web application"]
  node_frontend_app["React application<br/>[App.tsx]"]
  node_review_pages["Review and dashboard pages<br/>[ReviewDetails.tsx]"]
  node_repo_settings["Repository settings"]
  node_api_client["Frontend API client<br/>[client.ts]"]
end

node_github(("GitHub"))
node_gitlab(("GitLab"))
node_browser(("Browser user"))

node_api_app -->|"routes webhooks"| node_webhooks
node_api_app -->|"mounts routes"| node_api_routes
node_api_app -->|"instruments app"| node_metrics
node_github -->|"sends events"| node_api_app
node_gitlab -->|"sends events"| node_api_app
node_webhooks -->|"creates review jobs"| node_database
node_webhooks -->|"dispatches task"| node_job_worker
node_api_routes -->|"reads and writes"| node_database
node_api_routes -->|"dispatches task"| node_job_worker
node_job_worker -->|"starts review"| node_orchestrator
node_orchestrator -->|"ingests pull request"| node_pr_ingestion
node_orchestrator -->|"plans review"| node_review_planner
node_orchestrator -->|"runs analysis agents"| node_specialists
node_orchestrator -->|"uses static analysis"| node_static_pipeline
node_orchestrator -->|"synthesizes review"| node_llm
node_static_pipeline -->|"runs selected tools"| node_tool_runners
node_static_pipeline -->|"executes tools"| node_sandbox
node_browser -->|"uses interface"| node_frontend_app
node_frontend_app -->|"routes to pages"| node_review_pages
node_frontend_app -->|"routes to settings"| node_repo_settings
node_review_pages -.->|"requests review data"| node_api_client
node_repo_settings -.->|"requests repository data"| node_api_client
node_provider_clients -.->|"integrates with"| node_github
node_provider_clients -.->|"integrates with"| node_gitlab

click node_api_app "https://github.com/rohithbhagath/codesentinel/blob/main/backend/main.py"
click node_api_routes "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/api/v1/reviews.py"
click node_webhooks "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/integrations/gitlab/webhooks.py"
click node_job_worker "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/tasks/celery_worker.py"
click node_orchestrator "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/agents/orchestrator.py"
click node_pr_ingestion "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/pr_ingestor"
click node_review_planner "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/review_planner"
click node_specialists "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/specialist"
click node_llm "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/llm"
click node_static_pipeline "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/static_analysis/pipeline.py"
click node_sandbox "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/static_analysis/sandbox/docker_sandbox.py"
click node_tool_runners "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/static_analysis/tool_runners"
click node_database "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/db/session.py"
click node_provider_clients "https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/integrations"
click node_metrics "https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/metrics.py"
click node_frontend_app "https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/App.tsx"
click node_review_pages "https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/pages/ReviewDetails.tsx"
click node_repo_settings "https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/pages/RepositorySettings.tsx"
click node_api_client "https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/api/client.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_api_app,node_api_routes,node_metrics,node_browser toneBlue
class node_job_worker,node_orchestrator,node_pr_ingestion,node_review_planner,node_specialists toneAmber
class node_llm,node_static_pipeline,node_sandbox,node_tool_runners toneMint
class node_webhooks,node_database,node_provider_clients toneRose
class node_frontend_app,node_review_pages,node_repo_settings,node_api_client,node_github,node_gitlab toneIndigo
```

## Components

### Ingress and API

- [FastAPI app](https://github.com/rohithbhagath/codesentinel/blob/main/backend/main.py): `backend/main.py`
- [REST API](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/api/v1/reviews.py): `backend/app/api/v1/reviews.py`
- [Prometheus metrics](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/metrics.py): `backend/app/metrics.py`

### Review workflow

- [Celery worker](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/tasks/celery_worker.py): `backend/app/tasks/celery_worker.py`
- [Workflow orchestrator](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/agents/orchestrator.py): `backend/app/agents/orchestrator.py`
- [PR ingestion](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/pr_ingestor): `backend/app/agents/pr_ingestor`
- [Review planning](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/review_planner): `backend/app/agents/review_planner`
- [Specialist agents](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/agents/specialist): `backend/app/agents/specialist`

### Analysis engines

- [LLM review engine](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/llm): `backend/app/llm`
- [Static analysis pipeline](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/static_analysis/pipeline.py): `backend/app/static_analysis/pipeline.py`
- [Docker sandbox](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/static_analysis/sandbox/docker_sandbox.py): `backend/app/static_analysis/sandbox/docker_sandbox.py`
- [Static tool runners](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/static_analysis/tool_runners): `backend/app/static_analysis/tool_runners`

### Persistence and integrations

- [Provider webhooks](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/integrations/gitlab/webhooks.py): `backend/app/integrations/gitlab/webhooks.py`
- [Application database](https://github.com/rohithbhagath/codesentinel/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Provider clients](https://github.com/rohithbhagath/codesentinel/tree/main/backend/app/integrations): `backend/app/integrations`

### Web application

- [React application](https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Review and dashboard pages](https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/pages/ReviewDetails.tsx): `frontend/src/pages/ReviewDetails.tsx`
- [Repository settings](https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/pages/RepositorySettings.tsx): `frontend/src/pages/RepositorySettings.tsx`
- [Frontend API client](https://github.com/rohithbhagath/codesentinel/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Other components

- **GitHub**
- **GitLab**
- **Browser user**

## Connections

- FastAPI app → Provider webhooks: routes webhooks (evidence: `backend/main.py`)
- FastAPI app → REST API: mounts routes (evidence: `backend/main.py`)
- FastAPI app → Prometheus metrics: instruments app (evidence: `backend/main.py`)
- GitHub → FastAPI app: sends events (evidence: `backend/main.py`)
- GitLab → FastAPI app: sends events (evidence: `backend/main.py`)
- Provider webhooks → Application database: creates review jobs (evidence: `backend/app/integrations/gitlab/webhooks.py`)
- Provider webhooks → Celery worker: dispatches task (evidence: `backend/app/integrations/gitlab/webhooks.py`)
- REST API → Application database: reads and writes (evidence: `backend/app/api/v1/reviews.py`)
- REST API → Celery worker: dispatches task (evidence: `backend/app/api/v1/reviews.py`)
- Celery worker → Workflow orchestrator: starts review (evidence: `backend/app/tasks/celery_worker.py`)
- Workflow orchestrator → PR ingestion: ingests pull request
- Workflow orchestrator → Review planning: plans review
- Workflow orchestrator → Specialist agents: runs analysis agents
- Workflow orchestrator → Static analysis pipeline: uses static analysis
- Workflow orchestrator → LLM review engine: synthesizes review
- Static analysis pipeline → Static tool runners: runs selected tools (evidence: `backend/app/static_analysis/pipeline.py`)
- Static analysis pipeline → Docker sandbox: executes tools (evidence: `backend/app/static_analysis/pipeline.py`)
- Browser user → React application: uses interface (evidence: `frontend/src/App.tsx`)
- React application → Review and dashboard pages: routes to pages (evidence: `frontend/src/App.tsx`)
- React application → Repository settings: routes to settings (evidence: `frontend/src/App.tsx`)
- Review and dashboard pages → Frontend API client: requests review data
- Repository settings → Frontend API client: requests repository data
- Provider clients → GitHub: integrates with
- Provider clients → GitLab: integrates with
