# v7ren/sentinai-public architecture

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

- Interactive diagram: https://gitdiagram.com/v7ren/sentinai-public
- Repository: https://github.com/v7ren/sentinai-public

## Overview

SentinAI is a desktop-assisted security scanner for source code. The principal workflow is selecting a scan in the desktop app, submitting it through the gateway to the worker, indexing the project, and analyzing code for vulnerabilities; findings are then processed and returned. The repository also contains local scanning, persistence, report/SARIF output, and an optional OpenCode-backed LLM bridge. README content was not provided, and the worker orchestration excerpt is incomplete, so uncertain internal handoffs are omitted.

Main entry points: [`backend/worker/core/main.py`](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/main.py) (Scan Worker), [`desktop/src/App.tsx`](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/App.tsx) (Desktop App), [`backend/worker/core/agents/coordinator.py`](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/coordinator.py) (Agent Coordinator), [`desktop/src/pages/ScanPage.tsx`](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/pages/ScanPage.tsx) (Scan Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop Client"]
  node_desktop_app["Desktop App<br/>[App.tsx]"]
  node_scan_page["Scan Page<br/>[ScanPage.tsx]"]
  node_scan_api["Scan API<br/>[api.ts]"]
  node_settings["Settings UI<br/>[SettingsPage.tsx]"]
end

subgraph group_service["Scan Service"]
  node_gateway["Client Gateway<br/>[mainflask.py]"]
  node_worker["Scan Worker<br/>[main.py]"]
  node_local_scan["Local Scan Server"]
end

subgraph group_analysis["Analysis Engine"]
  node_project_index["Project Indexer<br/>[project_indexer.py]"]
  node_native_index["Native Index<br/>[lib.rs]"]
  node_agent_coordinator["Agent Coordinator<br/>[coordinator.py]"]
  node_specialists["Security Specialists"]
  node_dedup["Finding Deduplication"]
  node_validation["Finding Validation"]
end

subgraph group_results["Findings and Storage"]
  node_database[("Scan Database<br/>[operations.py]")]
  node_report["Markdown Reports"]
  node_sarif["SARIF Output<br/>[sarif_emitter.py]"]
end

subgraph group_llm["LLM Integration"]
  node_llm_client["LLM Client<br/>[llm_client.py]"]
  node_bridge_client["Bridge Client<br/>[deepseek_client.py]"]
  node_bridge_server["OpenCode Bridge<br/>[server.go]"]
end

node_user(("Scanner User"))
node_opencode["OpenCode Service"]

node_user -->|"uses"| node_desktop_app
node_desktop_app -->|"opens scan"| node_scan_page
node_desktop_app -->|"opens settings"| node_settings
node_scan_page -->|"submits scan"| node_scan_api
node_scan_api -->|"sends request"| node_gateway
node_gateway -->|"dispatches scan"| node_worker
node_worker -->|"indexes project"| node_project_index
node_project_index -->|"uses indexer"| node_native_index
node_worker -->|"runs analysis"| node_agent_coordinator
node_agent_coordinator -->|"dispatches agents"| node_specialists
node_worker -->|"deduplicates findings"| node_dedup
node_worker -->|"validates findings"| node_validation
node_worker -->|"persists index"| node_database
node_worker -->|"generates report"| node_report
node_worker -->|"emits findings"| node_sarif
node_agent_coordinator -->|"requests completions"| node_llm_client
node_llm_client -.->|"uses bridge fallback"| node_bridge_client
node_bridge_client -->|"posts completion"| node_bridge_server
node_bridge_server -->|"calls service"| node_opencode

click node_desktop_app "https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/App.tsx"
click node_scan_page "https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/pages/ScanPage.tsx"
click node_scan_api "https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/scan/api.ts"
click node_settings "https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/pages/SettingsPage.tsx"
click node_gateway "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/mainflask.py"
click node_worker "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/main.py"
click node_local_scan "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/local_scan_server.py"
click node_project_index "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/project_indexer.py"
click node_native_index "https://github.com/v7ren/sentinai-public/blob/main-v5/native/sentinai-index/src/lib.rs"
click node_agent_coordinator "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/coordinator.py"
click node_specialists "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/specialists/llm_security_agent.py"
click node_dedup "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/deduplication_engine.py"
click node_validation "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/findings_validator.py"
click node_database "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/database/operations.py"
click node_report "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/findings_md_generator.py"
click node_sarif "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/output/sarif_emitter.py"
click node_llm_client "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/llm_client.py"
click node_bridge_client "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/deepseek_client.py"
click node_bridge_server "https://github.com/v7ren/sentinai-public/blob/main-v5/backend/opencode-bridge/server.go"

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_desktop_app,node_scan_page,node_scan_api,node_settings,node_user toneBlue
class node_gateway,node_worker,node_local_scan toneAmber
class node_project_index,node_native_index,node_agent_coordinator,node_specialists,node_dedup,node_validation toneMint
class node_database,node_report,node_sarif toneRose
class node_llm_client,node_bridge_client,node_bridge_server,node_opencode toneIndigo
```

## Components

### Desktop Client

- [Desktop App](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/App.tsx): `desktop/src/App.tsx`
- [Scan Page](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/pages/ScanPage.tsx): `desktop/src/pages/ScanPage.tsx`
- [Scan API](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/scan/api.ts): `desktop/src/scan/api.ts`
- [Settings UI](https://github.com/v7ren/sentinai-public/blob/main-v5/desktop/src/pages/SettingsPage.tsx): `desktop/src/pages/SettingsPage.tsx`

### Scan Service

- [Client Gateway](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/mainflask.py): `backend/mainflask.py`
- [Scan Worker](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/main.py): `backend/worker/core/main.py`
- [Local Scan Server](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/local_scan_server.py): `backend/local_scan_server.py`

### Analysis Engine

- [Project Indexer](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/project_indexer.py): `backend/worker/core/project_indexer.py`
- [Native Index](https://github.com/v7ren/sentinai-public/blob/main-v5/native/sentinai-index/src/lib.rs): `native/sentinai-index/src/lib.rs`
- [Agent Coordinator](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/coordinator.py): `backend/worker/core/agents/coordinator.py`
- [Security Specialists](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/specialists/llm_security_agent.py): `backend/worker/core/agents/specialists/llm_security_agent.py`
- [Finding Deduplication](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/agents/deduplication_engine.py): `backend/worker/core/agents/deduplication_engine.py`
- [Finding Validation](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/findings_validator.py): `backend/worker/core/findings_validator.py`

### Findings and Storage

- [Scan Database](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/database/operations.py): `backend/database/operations.py`
- [Markdown Reports](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/findings_md_generator.py): `backend/findings_md_generator.py`
- [SARIF Output](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/output/sarif_emitter.py): `backend/worker/core/output/sarif_emitter.py`

### LLM Integration

- [LLM Client](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/llm_client.py): `backend/worker/core/llm_client.py`
- [Bridge Client](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/worker/core/deepseek_client.py): `backend/worker/core/deepseek_client.py`
- [OpenCode Bridge](https://github.com/v7ren/sentinai-public/blob/main-v5/backend/opencode-bridge/server.go): `backend/opencode-bridge/server.go`

### Other components

- **Scanner User**
- **OpenCode Service**

## Connections

- Scanner User → Desktop App: uses
- Desktop App → Scan Page: opens scan
- Desktop App → Settings UI: opens settings
- Scan Page → Scan API: submits scan
- Scan API → Client Gateway: sends request
- Client Gateway → Scan Worker: dispatches scan
- Scan Worker → Project Indexer: indexes project
- Project Indexer → Native Index: uses indexer
- Scan Worker → Agent Coordinator: runs analysis
- Agent Coordinator → Security Specialists: dispatches agents
- Scan Worker → Finding Deduplication: deduplicates findings
- Scan Worker → Finding Validation: validates findings
- Scan Worker → Scan Database: persists index
- Scan Worker → Markdown Reports: generates report
- Scan Worker → SARIF Output: emits findings
- Agent Coordinator → LLM Client: requests completions
- LLM Client → Bridge Client: uses bridge fallback
- Bridge Client → OpenCode Bridge: posts completion
- OpenCode Bridge → OpenCode Service: calls service
