# marwaneproo/sentinelgraph-ai architecture

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

- Interactive diagram: https://gitdiagram.com/marwaneproo/sentinelgraph-ai
- Repository: https://github.com/marwaneproo/sentinelgraph-ai

## Overview

SentinelGraph-AI is a SIEM application for collecting and normalizing security logs, detecting threats, managing alerts, investigating relationships, and presenting findings to analysts. The frontend’s authenticated navigation exposes log, alert, graph, AI, server, rules, and dashboard views; backend APIs and services provide those capabilities. Sampled code confirms detection reads MongoDB logs and rules, persists alerts, and syncs new alerts to Neo4j. Some API implementations and UI-to-endpoint mappings were not sampled, so those connections are left unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/App.tsx) (Authenticated app), [`frontend/src/services/api.ts`](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/services/api.ts) (API client), [`backend/app/api/router.py`](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/router.py) (API router), [`backend/app/engine/detector.py`](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/engine/detector.py) (Detection engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Analyst Experience"]
  node_app["Authenticated app<br/>[App.tsx]"]
  node_auth_ui["Auth context<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_logs_ui["Log explorer<br/>[LogsExplorer.tsx]"]
  node_alerts_ui["Alert management"]
  node_graph_ui["Threat graph view"]
  node_ai_ui["AI assistant<br/>[AIAssistant.tsx]"]
end

subgraph group_api["API and Identity"]
  node_api_router["API router<br/>[router.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_logs_api["Logs API<br/>[logs.py]"]
  node_alerts_api["Alerts API<br/>[alerts.py]"]
  node_graph_api["Graph API<br/>[graph.py]"]
  node_ai_api["AI API<br/>[ai.py]"]
end

subgraph group_security_ops["Security Operations"]
  node_log_service["Log processing<br/>[log_service.py]"]
  node_detector["Detection engine<br/>[detector.py]"]
  node_alert_service["Alert lifecycle<br/>[alert_service.py]"]
  node_audit["Audit trail<br/>[audit_service.py]"]
  node_rules["Detection rules"]
end

subgraph group_intelligence["Threat Intelligence"]
  node_graph_service["Graph investigations<br/>[graph_service.py]"]
  node_ai_service["AI analysis<br/>[ai_service.py]"]
end

subgraph group_persistence["Data Stores"]
  node_mongo[("MongoDB manager<br/>[mongodb.py]")]
  node_neo4j[("Neo4j manager<br/>[neo4j.py]")]
end

node_analyst(("Security analyst"))

node_analyst -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_logs_ui
node_app -->|"routes to"| node_alerts_ui
node_app -->|"routes to"| node_graph_ui
node_app -->|"routes to"| node_ai_ui
node_auth_ui -->|"requests auth"| node_api_client
node_api_router -->|"registers"| node_auth_api
node_api_router -->|"registers"| node_logs_api
node_api_router -->|"registers"| node_alerts_api
node_api_router -->|"registers"| node_graph_api
node_api_router -->|"registers"| node_ai_api
node_api_client -.->|"HTTP requests"| node_api_router
node_logs_api -->|"delegates to"| node_log_service
node_alerts_api -->|"uses"| node_alert_service
node_alerts_api -->|"invokes"| node_detector
node_ai_api -->|"invokes"| node_ai_service
node_detector -->|"reads and writes"| node_mongo
node_detector -->|"evaluates"| node_rules
node_detector -->|"syncs alerts"| node_neo4j
node_log_service -->|"stores logs"| node_mongo
node_log_service -->|"syncs graph"| node_neo4j
node_alert_service -->|"reads and writes"| node_mongo
node_alert_service -->|"syncs graph"| node_neo4j
node_graph_service -->|"queries graph"| node_neo4j
node_ai_service -->|"uses alert data"| node_alert_service
node_ai_service -->|"reads data"| node_mongo
node_auth_api -->|"reads users"| node_mongo
node_auth_api -->|"records actions"| node_audit
node_alerts_api -->|"records actions"| node_audit
node_dashboard -->|"requests data"| node_api_client
node_logs_ui -->|"requests logs"| node_api_client
node_alerts_ui -->|"requests alerts"| node_api_client
node_graph_ui -->|"requests graph"| node_api_client
node_ai_ui -->|"requests analysis"| node_api_client
node_log_service -.->|"detection workflow"| node_detector
node_graph_ui -.->|"investigates"| node_graph_service

click node_app "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/context/AuthContext.tsx"
click node_api_client "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/services/api.ts"
click node_dashboard "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/Dashboard.tsx"
click node_logs_ui "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/LogsExplorer.tsx"
click node_alerts_ui "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/AlertsManagement.tsx"
click node_graph_ui "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/components/graph/ThreatGraphView.tsx"
click node_ai_ui "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/AIAssistant.tsx"
click node_api_router "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/router.py"
click node_auth_api "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/auth.py"
click node_logs_api "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/logs.py"
click node_alerts_api "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/alerts.py"
click node_graph_api "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/graph.py"
click node_ai_api "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/ai.py"
click node_log_service "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/log_service.py"
click node_detector "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/engine/detector.py"
click node_alert_service "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/alert_service.py"
click node_audit "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/audit_service.py"
click node_rules "https://github.com/marwaneproo/sentinelgraph-ai/tree/main/backend/app/engine/rules"
click node_graph_service "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/graph_service.py"
click node_ai_service "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/ai_service.py"
click node_mongo "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/db/mongodb.py"
click node_neo4j "https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/db/neo4j.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_app,node_auth_ui,node_api_client,node_dashboard,node_logs_ui,node_alerts_ui,node_graph_ui,node_ai_ui toneBlue
class node_api_router,node_auth_api,node_logs_api,node_alerts_api,node_graph_api,node_ai_api toneAmber
class node_log_service,node_detector,node_alert_service,node_audit,node_rules toneMint
class node_graph_service,node_ai_service toneRose
class node_mongo,node_neo4j,node_analyst toneIndigo
```

## Components

### Analyst Experience

- [Authenticated app](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth context](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [API client](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Dashboard](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Log explorer](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/LogsExplorer.tsx): `frontend/src/pages/LogsExplorer.tsx`
- [Alert management](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/AlertsManagement.tsx): `frontend/src/pages/AlertsManagement.tsx`
- [Threat graph view](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/components/graph/ThreatGraphView.tsx): `frontend/src/components/graph/ThreatGraphView.tsx`
- [AI assistant](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/frontend/src/pages/AIAssistant.tsx): `frontend/src/pages/AIAssistant.tsx`

### API and Identity

- [API router](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Authentication API](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Logs API](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/logs.py): `backend/app/api/logs.py`
- [Alerts API](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/alerts.py): `backend/app/api/alerts.py`
- [Graph API](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/graph.py): `backend/app/api/graph.py`
- [AI API](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/api/ai.py): `backend/app/api/ai.py`

### Security Operations

- [Log processing](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/log_service.py): `backend/app/services/log_service.py`
- [Detection engine](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/engine/detector.py): `backend/app/engine/detector.py`
- [Alert lifecycle](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/alert_service.py): `backend/app/services/alert_service.py`
- [Audit trail](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/audit_service.py): `backend/app/services/audit_service.py`
- [Detection rules](https://github.com/marwaneproo/sentinelgraph-ai/tree/main/backend/app/engine/rules): `backend/app/engine/rules`

### Threat Intelligence

- [Graph investigations](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/graph_service.py): `backend/app/services/graph_service.py`
- [AI analysis](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/services/ai_service.py): `backend/app/services/ai_service.py`

### Data Stores

- [MongoDB manager](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/db/mongodb.py): `backend/app/db/mongodb.py`
- [Neo4j manager](https://github.com/marwaneproo/sentinelgraph-ai/blob/main/backend/app/db/neo4j.py): `backend/app/db/neo4j.py`

### Other components

- **Security analyst**

## Connections

- Security analyst → Authenticated app: uses (evidence: `frontend/src/App.tsx`)
- Authenticated app → Auth context: provides auth (evidence: `frontend/src/App.tsx`)
- Authenticated app → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → Log explorer: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → Alert management: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → Threat graph view: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → AI assistant: routes to (evidence: `frontend/src/App.tsx`)
- Auth context → API client: requests auth (evidence: `frontend/src/context/AuthContext.tsx`)
- API router → Authentication API: registers (evidence: `backend/app/api/router.py`)
- API router → Logs API: registers (evidence: `backend/app/api/router.py`)
- API router → Alerts API: registers (evidence: `backend/app/api/router.py`)
- API router → Graph API: registers (evidence: `backend/app/api/router.py`)
- API router → AI API: registers (evidence: `backend/app/api/router.py`)
- API client → API router: HTTP requests
- Logs API → Log processing: delegates to
- Alerts API → Alert lifecycle: uses (evidence: `backend/app/api/alerts.py`)
- Alerts API → Detection engine: invokes (evidence: `backend/app/api/alerts.py`)
- AI API → AI analysis: invokes (evidence: `backend/app/api/ai.py`)
- Detection engine → MongoDB manager: reads and writes (evidence: `backend/app/engine/detector.py`)
- Detection engine → Detection rules: evaluates (evidence: `backend/app/engine/detector.py`)
- Detection engine → Neo4j manager: syncs alerts (evidence: `backend/app/engine/detector.py`)
- Log processing → MongoDB manager: stores logs (evidence: `backend/app/services/log_service.py`)
- Log processing → Neo4j manager: syncs graph (evidence: `backend/app/services/log_service.py`)
- Alert lifecycle → MongoDB manager: reads and writes (evidence: `backend/app/services/alert_service.py`)
- Alert lifecycle → Neo4j manager: syncs graph (evidence: `backend/app/services/alert_service.py`)
- Graph investigations → Neo4j manager: queries graph (evidence: `backend/app/services/graph_service.py`)
- AI analysis → Alert lifecycle: uses alert data (evidence: `backend/app/services/ai_service.py`)
- AI analysis → MongoDB manager: reads data (evidence: `backend/app/services/ai_service.py`)
- Authentication API → MongoDB manager: reads users (evidence: `backend/app/api/auth.py`)
- Authentication API → Audit trail: records actions (evidence: `backend/app/api/auth.py`)
- Alerts API → Audit trail: records actions (evidence: `backend/app/api/alerts.py`)
- Dashboard → API client: requests data (evidence: `frontend/src/pages/Dashboard.tsx`)
- Log explorer → API client: requests logs (evidence: `frontend/src/pages/LogsExplorer.tsx`)
- Alert management → API client: requests alerts (evidence: `frontend/src/pages/AlertsManagement.tsx`)
- Threat graph view → API client: requests graph (evidence: `frontend/src/components/graph/ThreatGraphView.tsx`)
- AI assistant → API client: requests analysis (evidence: `frontend/src/pages/AIAssistant.tsx`)
- Log processing → Detection engine: detection workflow
- Threat graph view → Graph investigations: investigates
