# melopheelo12/shield architecture

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

- Interactive diagram: https://gitdiagram.com/melopheelo12/shield
- Repository: https://github.com/melopheelo12/shield

## Overview

SHIELD is a honeypot and security-observability dashboard. Attackers reach isolated SSH, HTTP and FTP decoys; captured events are ingested, grouped into sessions, enriched, scored with explainable rules, stored and surfaced through alerts and the dashboard. The dashboard also supports live events, analytics, threat mapping, defense controls, exports and an isolated training sandbox. Several subsystem links below follow the README or source-index references; unsampled implementation details are not asserted.

Main entry points: [`src/shield/collector/api/app.py`](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/api/app.py) (Collector API), [`dashboard/src/App.tsx`](https://github.com/melopheelo12/shield/blob/main/dashboard/src/App.tsx) (Dashboard app), [`dashboard/src/api/client.ts`](https://github.com/melopheelo12/shield/blob/main/dashboard/src/api/client.ts) (API client), [`src/shield/decoys/ssh.py`](https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/ssh.py) (SSH decoy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Decoy capture"]
  node_ssh["SSH decoy<br/>[ssh.py]"]
  node_http["HTTP decoy<br/>[http.py]"]
  node_ftp["FTP decoy<br/>[ftp.py]"]
end

subgraph group_process["Event processing"]
  node_contract["Event schema<br/>[schema.py]"]
  node_sessions["Session tracking<br/>[session_tracker.py]"]
  node_enrichment["Threat enrichment"]
  node_defender["Rule scoring<br/>[engine.py]"]
end

subgraph group_data["Persistence and alerts"]
  node_repository["Repository interface<br/>[base.py]"]
  node_postgres[("PostgreSQL store<br/>[postgres.py]")]
  node_alerts["Alert manager<br/>[manager.py]"]
  node_channels["Alert channels<br/>[channels.py]"]
end

subgraph group_api["Collector API"]
  node_collector["Collector API<br/>[app.py]"]
  node_realtime["Live event stream<br/>[realtime.py]"]
  node_sandbox["Training sandbox<br/>[sandbox.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_app["Dashboard app<br/>[App.tsx]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_api_client["API client<br/>[client.ts]"]
  node_attacks["Attack journal<br/>[Attacks.tsx]"]
  node_overview["Analytics overview<br/>[Overview.tsx]"]
  node_threatmap["Threat map<br/>[ThreatMap.tsx]"]
  node_defense_ui["Defense controls<br/>[Defense.tsx]"]
  node_sandbox_ui["Sandbox UI<br/>[Sandbox.tsx]"]
  node_stream_hook["Live stream client<br/>[useWebSocket.ts]"]
end

node_attacker(("Internet attackers"))
node_browser(("Dashboard operator"))
node_external_intel["Threat intelligence APIs"]

node_attacker -->|"probes"| node_ssh
node_attacker -->|"probes"| node_http
node_attacker -->|"probes"| node_ftp
node_ssh -->|"sends events"| node_collector
node_http -->|"sends events"| node_collector
node_ftp -->|"sends events"| node_collector
node_collector -->|"validates events"| node_contract
node_collector -->|"groups events"| node_sessions
node_collector -->|"enriches events"| node_enrichment
node_collector -->|"scores events"| node_defender
node_collector -->|"queries and writes"| node_repository
node_repository -->|"implements storage"| node_postgres
node_collector -->|"evaluates thresholds"| node_alerts
node_alerts -->|"dispatches notices"| node_channels
node_enrichment -.->|"looks up intelligence"| node_external_intel
node_collector -->|"serves live events"| node_realtime
node_collector -->|"exposes training"| node_sandbox
node_browser -->|"uses dashboard"| node_app
node_app -->|"checks session"| node_auth
node_app -.->|"routes to"| node_attacks
node_app -.->|"routes to"| node_overview
node_app -.->|"routes to"| node_threatmap
node_app -.->|"routes to"| node_defense_ui
node_app -.->|"routes to"| node_sandbox_ui
node_attacks -.->|"requests data"| node_api_client
node_overview -.->|"requests statistics"| node_api_client
node_threatmap -.->|"requests geography"| node_api_client
node_defense_ui -.->|"uses API"| node_api_client
node_sandbox_ui -.->|"uses API"| node_api_client
node_api_client -.->|"calls endpoints"| node_collector
node_app -->|"provides event stream"| node_stream_hook
node_stream_hook -.->|"opens WebSocket"| node_realtime

click node_ssh "https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/ssh.py"
click node_http "https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/http.py"
click node_ftp "https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/ftp.py"
click node_contract "https://github.com/melopheelo12/shield/blob/main/src/shield/common/schema.py"
click node_sessions "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/ingest/session_tracker.py"
click node_enrichment "https://github.com/melopheelo12/shield/tree/main/src/shield/collector/enrichment"
click node_defender "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/defender/engine.py"
click node_repository "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/repositories/base.py"
click node_postgres "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/repositories/postgres.py"
click node_alerts "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/alerts/manager.py"
click node_channels "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/alerts/channels.py"
click node_collector "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/api/app.py"
click node_realtime "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/realtime.py"
click node_sandbox "https://github.com/melopheelo12/shield/blob/main/src/shield/collector/sandbox.py"
click node_app "https://github.com/melopheelo12/shield/blob/main/dashboard/src/App.tsx"
click node_auth "https://github.com/melopheelo12/shield/blob/main/dashboard/src/api/auth.ts"
click node_api_client "https://github.com/melopheelo12/shield/blob/main/dashboard/src/api/client.ts"
click node_attacks "https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Attacks.tsx"
click node_overview "https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Overview.tsx"
click node_threatmap "https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/ThreatMap.tsx"
click node_defense_ui "https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Defense.tsx"
click node_sandbox_ui "https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Sandbox.tsx"
click node_stream_hook "https://github.com/melopheelo12/shield/blob/main/dashboard/src/hooks/useWebSocket.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_ssh,node_http,node_ftp toneBlue
class node_contract,node_sessions,node_enrichment,node_defender toneAmber
class node_repository,node_postgres,node_alerts,node_channels,node_external_intel toneMint
class node_collector,node_realtime,node_sandbox toneRose
class node_app,node_auth,node_api_client,node_attacks,node_overview,node_threatmap,node_defense_ui,node_sandbox_ui,node_stream_hook,node_attacker,node_browser toneIndigo
```

## Components

### Decoy capture

- [SSH decoy](https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/ssh.py): `src/shield/decoys/ssh.py`
- [HTTP decoy](https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/http.py): `src/shield/decoys/http.py`
- [FTP decoy](https://github.com/melopheelo12/shield/blob/main/src/shield/decoys/ftp.py): `src/shield/decoys/ftp.py`

### Event processing

- [Event schema](https://github.com/melopheelo12/shield/blob/main/src/shield/common/schema.py): `src/shield/common/schema.py`
- [Session tracking](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/ingest/session_tracker.py): `src/shield/collector/ingest/session_tracker.py`
- [Threat enrichment](https://github.com/melopheelo12/shield/tree/main/src/shield/collector/enrichment): `src/shield/collector/enrichment`
- [Rule scoring](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/defender/engine.py): `src/shield/collector/defender/engine.py`

### Persistence and alerts

- [Repository interface](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/repositories/base.py): `src/shield/collector/repositories/base.py`
- [PostgreSQL store](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/repositories/postgres.py): `src/shield/collector/repositories/postgres.py`
- [Alert manager](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/alerts/manager.py): `src/shield/collector/alerts/manager.py`
- [Alert channels](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/alerts/channels.py): `src/shield/collector/alerts/channels.py`

### Collector API

- [Collector API](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/api/app.py): `src/shield/collector/api/app.py`
- [Live event stream](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/realtime.py): `src/shield/collector/realtime.py`
- [Training sandbox](https://github.com/melopheelo12/shield/blob/main/src/shield/collector/sandbox.py): `src/shield/collector/sandbox.py`

### Dashboard

- [Dashboard app](https://github.com/melopheelo12/shield/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Authentication](https://github.com/melopheelo12/shield/blob/main/dashboard/src/api/auth.ts): `dashboard/src/api/auth.ts`
- [API client](https://github.com/melopheelo12/shield/blob/main/dashboard/src/api/client.ts): `dashboard/src/api/client.ts`
- [Attack journal](https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Attacks.tsx): `dashboard/src/pages/Attacks.tsx`
- [Analytics overview](https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Overview.tsx): `dashboard/src/pages/Overview.tsx`
- [Threat map](https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/ThreatMap.tsx): `dashboard/src/pages/ThreatMap.tsx`
- [Defense controls](https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Defense.tsx): `dashboard/src/pages/Defense.tsx`
- [Sandbox UI](https://github.com/melopheelo12/shield/blob/main/dashboard/src/pages/Sandbox.tsx): `dashboard/src/pages/Sandbox.tsx`
- [Live stream client](https://github.com/melopheelo12/shield/blob/main/dashboard/src/hooks/useWebSocket.ts): `dashboard/src/hooks/useWebSocket.ts`

### Other components

- **Internet attackers**
- **Dashboard operator**
- **Threat intelligence APIs**

## Connections

- Internet attackers → SSH decoy: probes
- Internet attackers → HTTP decoy: probes
- Internet attackers → FTP decoy: probes
- SSH decoy → Collector API: sends events
- HTTP decoy → Collector API: sends events
- FTP decoy → Collector API: sends events
- Collector API → Event schema: validates events (evidence: `src/shield/collector/api/app.py`)
- Collector API → Session tracking: groups events (evidence: `src/shield/collector/api/app.py`)
- Collector API → Threat enrichment: enriches events (evidence: `src/shield/collector/api/app.py`)
- Collector API → Rule scoring: scores events (evidence: `src/shield/collector/api/app.py`)
- Collector API → Repository interface: queries and writes (evidence: `src/shield/collector/api/app.py`)
- Repository interface → PostgreSQL store: implements storage (evidence: `src/shield/collector/repositories/postgres.py`)
- Collector API → Alert manager: evaluates thresholds
- Alert manager → Alert channels: dispatches notices (evidence: `src/shield/collector/alerts/service.py`)
- Threat enrichment → Threat intelligence APIs: looks up intelligence
- Collector API → Live event stream: serves live events (evidence: `src/shield/collector/api/app.py`)
- Collector API → Training sandbox: exposes training (evidence: `src/shield/collector/api/app.py`)
- Dashboard operator → Dashboard app: uses dashboard (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Authentication: checks session (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Attack journal: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Analytics overview: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Threat map: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Defense controls: routes to (evidence: `dashboard/src/App.tsx`)
- Dashboard app → Sandbox UI: routes to (evidence: `dashboard/src/App.tsx`)
- Attack journal → API client: requests data
- Analytics overview → API client: requests statistics
- Threat map → API client: requests geography
- Defense controls → API client: uses API
- Sandbox UI → API client: uses API
- API client → Collector API: calls endpoints
- Dashboard app → Live stream client: provides event stream (evidence: `dashboard/src/App.tsx`)
- Live stream client → Live event stream: opens WebSocket
