# cipher-sheild/openthreat architecture

> Architecture diagram of the GitHub repository cipher-sheild/openthreat, 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/cipher-sheild/openthreat
- Repository: https://github.com/cipher-sheild/openthreat

## Overview

OpenThreat turns collected or analyst-uploaded cyber threat reports into searchable, evidence-linked intelligence. Collection and upload feed a platform-owned processing worker, which calls the NLP service; extracted facts and provenance are persisted, with document vectors indexed for similarity search. Analysts use the browser interface to explore documents, analytics, relationships, and exports. The README documents capabilities beyond the sampled implementation, including PDF imports and restricted STIX exports; those are represented at the platform API level rather than attributed to unsampled modules.

Main entry points: [`nlp-service/app/pipeline/analyzer.py`](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/analyzer.py) (Report analysis), [`platform-service/app/api/ingestion.py`](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/api/ingestion.py) (Ingestion worker), [`nlp-service/app/main.py`](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/main.py) (NLP API), [`platform-service/app/main.py`](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/main.py) (Platform API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Analyst interface"]
  node_browser["Browser app<br/>[App.tsx]"]
  node_graphview["Relationship graph<br/>[GraphView.tsx]"]
end

subgraph group_platform["Platform service"]
  node_collectors["NVD, CISA, RSS"]
  node_scheduler["Collection scheduler<br/>[scheduler.py]"]
  node_platformapi["Platform API<br/>[main.py]"]
  node_ingestion["Ingestion worker<br/>[ingestion.py]"]
  node_intelapi["Intel API<br/>[intel.py]"]
  node_lifecycle["Fact lifecycle<br/>[engine.py]"]
end

subgraph group_nlp["NLP analysis"]
  node_nlpservice["NLP API<br/>[main.py]"]
  node_analysis["Report analysis<br/>[analyzer.py]"]
  node_preprocess["Text preparation<br/>[preprocess.py]"]
  node_entityextract["Entity extraction<br/>[ner.py]"]
  node_relationextract["Relation extraction<br/>[relations.py]"]
  node_temporal["Temporal analysis<br/>[temporal.py]"]
  node_behaviors["Behavior analysis<br/>[behaviors.py]"]
  node_attackmap["ATT&amp;CK mapping<br/>[attack_mapper.py]"]
  node_embeddings["Embedding engine<br/>[embeddings.py]"]
  node_resolution["Entity resolution<br/>[resolution.py]"]
  node_novelty["Novelty classifier<br/>[novelty.py]"]
end

subgraph group_storage["Intelligence stores"]
  node_relationaldb[("PostgreSQL<br/>[database.py]")]
  node_vectordb[("Qdrant<br/>[database.py]")]
end

node_analyst(("Analyst"))
node_sources(("Threat sources"))

node_analyst -->|"uses"| node_browser
node_browser -->|"renders"| node_graphview
node_browser -.->|"requests data"| node_platformapi
node_sources -->|"publishes reports"| node_collectors
node_scheduler -->|"dispatches fetch"| node_collectors
node_scheduler -->|"submits reports"| node_ingestion
node_platformapi -->|"registers routes"| node_ingestion
node_platformapi -->|"registers routes"| node_intelapi
node_platformapi -->|"starts"| node_scheduler
node_analyst -->|"uploads reports"| node_ingestion
node_ingestion -->|"posts analysis"| node_nlpservice
node_ingestion -->|"persists findings"| node_lifecycle
node_lifecycle -->|"requests classification"| node_nlpservice
node_ingestion -->|"updates documents"| node_relationaldb
node_ingestion -->|"indexes vectors"| node_vectordb
node_intelapi -->|"queries intelligence"| node_relationaldb
node_intelapi -.->|"searches documents"| node_vectordb
node_nlpservice -->|"analyzes reports"| node_analysis
node_nlpservice -->|"serves embeddings"| node_embeddings
node_nlpservice -->|"resolves mentions"| node_resolution
node_nlpservice -->|"classifies facts"| node_novelty
node_analysis -->|"prepares text"| node_preprocess
node_analysis -->|"extracts entities"| node_entityextract
node_analysis -->|"extracts relations"| node_relationextract
node_analysis -->|"extracts events"| node_temporal
node_analysis -->|"extracts behaviors"| node_behaviors
node_analysis -->|"embeds document"| node_embeddings
node_analysis -->|"maps behaviors"| node_attackmap
node_attackmap -->|"compares semantics"| node_embeddings
node_lifecycle -->|"stores provenance"| node_relationaldb
node_resolution -->|"uses similarity"| node_embeddings

click node_browser "https://github.com/cipher-sheild/openthreat/blob/main/frontend/src/App.tsx"
click node_graphview "https://github.com/cipher-sheild/openthreat/blob/main/frontend/src/GraphView.tsx"
click node_collectors "https://github.com/cipher-sheild/openthreat/tree/main/platform-service/app/collectors"
click node_scheduler "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/core/scheduler.py"
click node_platformapi "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/main.py"
click node_ingestion "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/api/ingestion.py"
click node_intelapi "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/api/intel.py"
click node_lifecycle "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/novelty/engine.py"
click node_nlpservice "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/main.py"
click node_analysis "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/analyzer.py"
click node_preprocess "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/preprocess.py"
click node_entityextract "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/ner.py"
click node_relationextract "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/relations.py"
click node_temporal "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/temporal.py"
click node_behaviors "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/behaviors.py"
click node_attackmap "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/attack_mapper.py"
click node_embeddings "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/embeddings.py"
click node_resolution "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/resolution.py"
click node_novelty "https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/novelty.py"
click node_relationaldb "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/database/database.py"
click node_vectordb "https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/database/database.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_browser,node_graphview toneBlue
class node_collectors,node_scheduler,node_platformapi,node_ingestion,node_intelapi,node_lifecycle toneAmber
class node_nlpservice,node_analysis,node_preprocess,node_entityextract,node_relationextract,node_temporal,node_behaviors,node_attackmap,node_embeddings,node_resolution,node_novelty toneMint
class node_relationaldb,node_vectordb toneRose
class node_analyst,node_sources toneIndigo
```

## Components

### Analyst interface

- [Browser app](https://github.com/cipher-sheild/openthreat/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Relationship graph](https://github.com/cipher-sheild/openthreat/blob/main/frontend/src/GraphView.tsx): `frontend/src/GraphView.tsx`

### Platform service

- [NVD, CISA, RSS](https://github.com/cipher-sheild/openthreat/tree/main/platform-service/app/collectors): `platform-service/app/collectors`
- [Collection scheduler](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/core/scheduler.py): `platform-service/app/core/scheduler.py`
- [Platform API](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/main.py): `platform-service/app/main.py`
- [Ingestion worker](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/api/ingestion.py): `platform-service/app/api/ingestion.py`
- [Intel API](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/api/intel.py): `platform-service/app/api/intel.py`
- [Fact lifecycle](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/novelty/engine.py): `platform-service/app/novelty/engine.py`

### NLP analysis

- [NLP API](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/main.py): `nlp-service/app/main.py`
- [Report analysis](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/analyzer.py): `nlp-service/app/pipeline/analyzer.py`
- [Text preparation](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/preprocess.py): `nlp-service/app/pipeline/preprocess.py`
- [Entity extraction](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/ner.py): `nlp-service/app/pipeline/ner.py`
- [Relation extraction](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/relations.py): `nlp-service/app/pipeline/relations.py`
- [Temporal analysis](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/temporal.py): `nlp-service/app/pipeline/temporal.py`
- [Behavior analysis](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/behaviors.py): `nlp-service/app/pipeline/behaviors.py`
- [ATT&CK mapping](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/attack_mapper.py): `nlp-service/app/pipeline/attack_mapper.py`
- [Embedding engine](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/embeddings.py): `nlp-service/app/pipeline/embeddings.py`
- [Entity resolution](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/resolution.py): `nlp-service/app/pipeline/resolution.py`
- [Novelty classifier](https://github.com/cipher-sheild/openthreat/blob/main/nlp-service/app/pipeline/novelty.py): `nlp-service/app/pipeline/novelty.py`

### Intelligence stores

- [PostgreSQL](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/database/database.py): `platform-service/app/database/database.py`
- [Qdrant](https://github.com/cipher-sheild/openthreat/blob/main/platform-service/app/database/database.py): `platform-service/app/database/database.py`

### Other components

- **Analyst**
- **Threat sources**

## Connections

- Analyst → Browser app: uses
- Browser app → Relationship graph: renders (evidence: `frontend/src/App.tsx`)
- Browser app → Platform API: requests data
- Threat sources → NVD, CISA, RSS: publishes reports
- Collection scheduler → NVD, CISA, RSS: dispatches fetch (evidence: `platform-service/app/core/scheduler.py`)
- Collection scheduler → Ingestion worker: submits reports (evidence: `platform-service/app/core/scheduler.py`)
- Platform API → Ingestion worker: registers routes (evidence: `platform-service/app/main.py`)
- Platform API → Intel API: registers routes (evidence: `platform-service/app/main.py`)
- Platform API → Collection scheduler: starts (evidence: `platform-service/app/main.py`)
- Analyst → Ingestion worker: uploads reports (evidence: `platform-service/app/api/ingestion.py`)
- Ingestion worker → NLP API: posts analysis (evidence: `platform-service/app/api/ingestion.py`)
- Ingestion worker → Fact lifecycle: persists findings (evidence: `platform-service/app/api/ingestion.py`)
- Fact lifecycle → NLP API: requests classification (evidence: `platform-service/app/novelty/engine.py`)
- Ingestion worker → PostgreSQL: updates documents (evidence: `platform-service/app/api/ingestion.py`)
- Ingestion worker → Qdrant: indexes vectors (evidence: `platform-service/app/api/ingestion.py`)
- Intel API → PostgreSQL: queries intelligence (evidence: `platform-service/app/api/intel.py`)
- Intel API → Qdrant: searches documents (evidence: `platform-service/app/api/intel.py`)
- NLP API → Report analysis: analyzes reports (evidence: `nlp-service/app/main.py`)
- NLP API → Embedding engine: serves embeddings (evidence: `nlp-service/app/main.py`)
- NLP API → Entity resolution: resolves mentions (evidence: `nlp-service/app/main.py`)
- NLP API → Novelty classifier: classifies facts (evidence: `nlp-service/app/main.py`)
- Report analysis → Text preparation: prepares text (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → Entity extraction: extracts entities (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → Relation extraction: extracts relations (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → Temporal analysis: extracts events (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → Behavior analysis: extracts behaviors (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → Embedding engine: embeds document (evidence: `nlp-service/app/pipeline/analyzer.py`)
- Report analysis → ATT&CK mapping: maps behaviors (evidence: `nlp-service/app/pipeline/analyzer.py`)
- ATT&CK mapping → Embedding engine: compares semantics (evidence: `nlp-service/app/pipeline/attack_mapper.py`)
- Fact lifecycle → PostgreSQL: stores provenance (evidence: `platform-service/app/novelty/engine.py`)
- Entity resolution → Embedding engine: uses similarity (evidence: `nlp-service/app/pipeline/resolution.py`)
