# k-anjan25/ai-enhanced-cybersecurity-threat-detector architecture

> Architecture diagram of the GitHub repository k-anjan25/ai-enhanced-cybersecurity-threat-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector
- Repository: https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector

## Overview

AEGIS ingests network flows and system logs, scores telemetry for threats, and presents resulting alerts and operational context to analysts. The principal documented path is ingest validation and publication, scoring/correlation, alert persistence and notification, then dashboard triage. The repository also documents hunt, traffic/log exploration, model operations, administration, audit, and webhook capabilities. Several backend routes and service implementations were not sampled, so those branches are represented at subsystem level and their connections rely on README statements rather than inferred internal calls.

Main entry points: [`dashboard/src/App.tsx`](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/App.tsx) (Dashboard routing), [`backend/app/pipeline.py`](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/pipeline.py) (Pipeline orchestration), [`backend/app/api/v1/endpoints/ingest.py`](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/ingest.py) (Ingest endpoints), [`backend/app/services/alert_store.py`](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/alert_store.py) (Alert store and stream)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend API"]
  node_api_app["API composition<br/>[main.py]"]
  node_ingest_api["Ingest endpoints<br/>[ingest.py]"]
  node_ingest_service["Batch validation<br/>[ingest_service.py]"]
  node_wire_schemas["Telemetry contracts<br/>[ingest.py]"]
  node_alerts[("Alert store and stream<br/>[alert_store.py]")]
  node_alert_api["Alert and stream API<br/>[alerts.py]"]
  node_hunt_logs["Hunt and log exploration<br/>[hunt.py]"]
  node_auth_admin["Identity and administration<br/>[rbac.py]"]
end

subgraph group_detection["Detection pipeline"]
  node_pipeline["Pipeline orchestration<br/>[pipeline.py]"]
  node_scoring_worker["Window scoring<br/>[scoring_worker.py]"]
  node_correlator["Alert correlation<br/>[correlator.py]"]
  node_entity_registry["Entity registry<br/>[entity_registry.py]"]
end

subgraph group_ml["ML service"]
  node_ml_data["Telemetry records and windows<br/>[windowing.py]"]
  node_ml_models["FlowNet and LogNet<br/>[flownet.py]"]
  node_ml_scoring["Serving and scoring<br/>[scoring.py]"]
  node_ml_registry[("Model registry<br/>[model_registry.py]")]
  node_ml_training["Model training<br/>[pipeline.py]"]
end

subgraph group_dashboard["Analyst dashboard"]
  node_dashboard_app["Dashboard routing<br/>[App.tsx]"]
  node_dashboard_api["Dashboard API client<br/>[client.ts]"]
  node_overview["Overview and health<br/>[OverviewPage.tsx]"]
  node_triage["Alert triage<br/>[TriagePage.tsx]"]
  node_realtime["Live alert stream"]
  node_traffic["Traffic explorer<br/>[TrafficPage.tsx]"]
  node_logs_ui["Log explorer<br/>[LogsPage.tsx]"]
  node_hunt_ui["Hunt console<br/>[HuntPage.tsx]"]
  node_model_ops["Model operations UI<br/>[ModelsPage.tsx]"]
  node_admin_ui["Administration UI<br/>[AdminPage.tsx]"]
end

subgraph group_operations["Operations"]
  node_audit[("Append-only audit<br/>[audit_log.py]")]
  node_webhooks["Webhook delivery"]
end

node_analyst(("Analyst / operator"))
node_telemetry(("Flow and log sources"))
node_postgres[("PostgreSQL")]
node_kafka["Kafka"]

node_analyst -->|"uses"| node_dashboard_app
node_dashboard_app -.->|"routes through"| node_dashboard_api
node_telemetry -.->|"submits records"| node_ingest_api
node_ingest_api -->|"validates batches"| node_ingest_service
node_ingest_service -->|"validates against"| node_wire_schemas
node_ingest_api -->|"publishes accepted"| node_kafka
node_pipeline -->|"dispatches scoring"| node_scoring_worker
node_pipeline -->|"correlates outcomes"| node_correlator
node_pipeline -->|"resolves entities"| node_entity_registry
node_pipeline -->|"writes alerts"| node_alerts
node_pipeline -->|"consumes telemetry"| node_kafka
node_alerts -.->|"persists alerts"| node_postgres
node_alert_api -.->|"queries and streams"| node_alerts
node_dashboard_api -.->|"requests alerts"| node_alert_api
node_realtime -.->|"receives live alerts"| node_alert_api
node_dashboard_app -->|"routes to"| node_overview
node_dashboard_app -->|"routes to"| node_triage
node_dashboard_app -->|"routes to"| node_traffic
node_dashboard_app -->|"routes to"| node_logs_ui
node_dashboard_app -->|"routes to"| node_hunt_ui
node_dashboard_app -->|"routes to"| node_model_ops
node_dashboard_app -->|"routes to"| node_admin_ui
node_hunt_ui -.->|"runs audited hunts"| node_hunt_logs
node_ingest_api -.->|"records mutations"| node_audit
node_auth_admin -.->|"audits actions"| node_audit
node_webhooks -.->|"delivers notifications"| node_analyst
node_scoring_worker -->|"windows records"| node_ml_data
node_ml_training -->|"configures FlowNet"| node_ml_models
node_ml_scoring -.->|"scores with"| node_ml_models
node_ml_scoring -->|"loads registered models"| node_ml_registry

click node_api_app "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/main.py"
click node_ingest_api "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/ingest.py"
click node_ingest_service "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/ingest_service.py"
click node_wire_schemas "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/schemas/ingest.py"
click node_pipeline "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/pipeline.py"
click node_scoring_worker "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/workers/scoring_worker.py"
click node_correlator "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/correlator.py"
click node_entity_registry "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/entity_registry.py"
click node_alerts "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/alert_store.py"
click node_alert_api "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/alerts.py"
click node_hunt_logs "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/hunt.py"
click node_auth_admin "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/auth/rbac.py"
click node_audit "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/audit_log.py"
click node_webhooks "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/webhook_delivery.py"
click node_ml_data "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/data/windowing.py"
click node_ml_models "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/models/flownet.py"
click node_ml_scoring "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/serving/scoring.py"
click node_ml_registry "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/registry/model_registry.py"
click node_ml_training "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/training/pipeline.py"
click node_dashboard_app "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/App.tsx"
click node_dashboard_api "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/api/client.ts"
click node_overview "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/overview/pages/OverviewPage.tsx"
click node_triage "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/triage/pages/TriagePage.tsx"
click node_realtime "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/components/realtime/RealtimeProvider.tsx"
click node_traffic "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/traffic/pages/TrafficPage.tsx"
click node_logs_ui "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/logs/pages/LogsPage.tsx"
click node_hunt_ui "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/hunt/pages/HuntPage.tsx"
click node_model_ops "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/models/pages/ModelsPage.tsx"
click node_admin_ui "https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/admin/pages/AdminPage.tsx"

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_ingest_api,node_ingest_service,node_wire_schemas,node_alerts,node_alert_api,node_hunt_logs,node_auth_admin toneBlue
class node_pipeline,node_scoring_worker,node_correlator,node_entity_registry,node_postgres toneAmber
class node_ml_data,node_ml_models,node_ml_scoring,node_ml_registry,node_ml_training toneMint
class node_dashboard_app,node_dashboard_api,node_overview,node_triage,node_realtime,node_traffic,node_logs_ui,node_hunt_ui,node_model_ops,node_admin_ui toneRose
class node_audit,node_webhooks,node_analyst,node_telemetry,node_kafka toneIndigo
```

## Components

### Backend API

- [API composition](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/main.py): `backend/app/main.py`
- [Ingest endpoints](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/ingest.py): `backend/app/api/v1/endpoints/ingest.py`
- [Batch validation](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/ingest_service.py): `backend/app/services/ingest_service.py`
- [Telemetry contracts](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/schemas/ingest.py): `backend/app/schemas/ingest.py`
- [Alert store and stream](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/alert_store.py): `backend/app/services/alert_store.py`
- [Alert and stream API](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/alerts.py): `backend/app/api/v1/endpoints/alerts.py`
- [Hunt and log exploration](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/api/v1/endpoints/hunt.py): `backend/app/api/v1/endpoints/hunt.py`
- [Identity and administration](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/auth/rbac.py): `backend/app/auth/rbac.py`

### Detection pipeline

- [Pipeline orchestration](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`
- [Window scoring](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/workers/scoring_worker.py): `backend/app/workers/scoring_worker.py`
- [Alert correlation](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/correlator.py): `backend/app/services/correlator.py`
- [Entity registry](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/entity_registry.py): `backend/app/services/entity_registry.py`

### ML service

- [Telemetry records and windows](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/data/windowing.py): `ml-service/aegis_ml/data/windowing.py`
- [FlowNet and LogNet](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/models/flownet.py): `ml-service/aegis_ml/models/flownet.py`
- [Serving and scoring](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/serving/scoring.py): `ml-service/aegis_ml/serving/scoring.py`
- [Model registry](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/registry/model_registry.py): `ml-service/aegis_ml/registry/model_registry.py`
- [Model training](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/ml-service/aegis_ml/training/pipeline.py): `ml-service/aegis_ml/training/pipeline.py`

### Analyst dashboard

- [Dashboard routing](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Dashboard API client](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/api/client.ts): `dashboard/src/api/client.ts`
- [Overview and health](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/overview/pages/OverviewPage.tsx): `dashboard/src/features/overview/pages/OverviewPage.tsx`
- [Alert triage](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/triage/pages/TriagePage.tsx): `dashboard/src/features/triage/pages/TriagePage.tsx`
- [Live alert stream](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/components/realtime/RealtimeProvider.tsx): `dashboard/src/components/realtime/RealtimeProvider.tsx`
- [Traffic explorer](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/traffic/pages/TrafficPage.tsx): `dashboard/src/features/traffic/pages/TrafficPage.tsx`
- [Log explorer](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/logs/pages/LogsPage.tsx): `dashboard/src/features/logs/pages/LogsPage.tsx`
- [Hunt console](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/hunt/pages/HuntPage.tsx): `dashboard/src/features/hunt/pages/HuntPage.tsx`
- [Model operations UI](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/models/pages/ModelsPage.tsx): `dashboard/src/features/models/pages/ModelsPage.tsx`
- [Administration UI](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/dashboard/src/features/admin/pages/AdminPage.tsx): `dashboard/src/features/admin/pages/AdminPage.tsx`

### Operations

- [Append-only audit](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/audit_log.py): `backend/app/services/audit_log.py`
- [Webhook delivery](https://github.com/k-anjan25/ai-enhanced-cybersecurity-threat-detector/blob/main/backend/app/services/webhook_delivery.py): `backend/app/services/webhook_delivery.py`

### Other components

- **Analyst / operator**
- **Flow and log sources**
- **PostgreSQL**
- **Kafka**

## Connections

- Analyst / operator → Dashboard routing: uses (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Dashboard API client: routes through
- Flow and log sources → Ingest endpoints: submits records
- Ingest endpoints → Batch validation: validates batches (evidence: `backend/app/api/v1/endpoints/ingest.py`)
- Batch validation → Telemetry contracts: validates against (evidence: `backend/app/services/ingest_service.py`)
- Ingest endpoints → Kafka: publishes accepted (evidence: `backend/app/api/v1/endpoints/ingest.py`)
- Pipeline orchestration → Window scoring: dispatches scoring (evidence: `backend/app/pipeline.py`)
- Pipeline orchestration → Alert correlation: correlates outcomes (evidence: `backend/app/pipeline.py`)
- Pipeline orchestration → Entity registry: resolves entities (evidence: `backend/app/pipeline.py`)
- Pipeline orchestration → Alert store and stream: writes alerts (evidence: `backend/app/pipeline.py`)
- Pipeline orchestration → Kafka: consumes telemetry (evidence: `backend/app/pipeline.py`)
- Alert store and stream → PostgreSQL: persists alerts
- Alert and stream API → Alert store and stream: queries and streams (evidence: `README.md`)
- Dashboard API client → Alert and stream API: requests alerts (evidence: `README.md`)
- Live alert stream → Alert and stream API: receives live alerts (evidence: `README.md`)
- Dashboard routing → Overview and health: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Alert triage: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Traffic explorer: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Log explorer: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Hunt console: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Model operations UI: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard routing → Administration UI: routes to (evidence: `dashboard/src/App.tsx`)
- Hunt console → Hunt and log exploration: runs audited hunts (evidence: `README.md`)
- Ingest endpoints → Append-only audit: records mutations (evidence: `README.md`)
- Identity and administration → Append-only audit: audits actions (evidence: `README.md`)
- Webhook delivery → Analyst / operator: delivers notifications (evidence: `README.md`)
- Window scoring → Telemetry records and windows: windows records (evidence: `backend/app/workers/scoring_worker.py`)
- Model training → FlowNet and LogNet: configures FlowNet (evidence: `ml-service/aegis_ml/training/pipeline.py`)
- Serving and scoring → FlowNet and LogNet: scores with
- Serving and scoring → Model registry: loads registered models (evidence: `ml-service/aegis_ml/serving/app.py`)
