# ngnicky-ai/kr-secwatch architecture

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

- Interactive diagram: https://gitdiagram.com/ngnicky-ai/kr-secwatch
- Repository: https://github.com/ngnicky-ai/kr-secwatch

## Overview

KR-SecWatch collects security news, ransomware victim disclosures, and CVE intelligence, then classifies Korea-related threats, persists them, evaluates alerts, and presents the results through a Flask dashboard, APIs, and Slack. The scheduler coordinates recurring collection and alert evaluation; user-facing routes and query modules serve dashboard, ransomware, CVE, alert, and unified-search capabilities. Edges reflect README-documented flows or relationships visible in the excerpts and SOURCE INDEX; unsampled subsystem links are omitted where their callers are not evidenced.

Main entry points: [`app/routes/api.py`](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/api.py) (JSON API), [`app/collectors/rss.py`](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/rss.py) (RSS Collector), [`app/__init__.py`](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/__init__.py) (Flask Application), [`app/scheduler.py`](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/scheduler.py) (Collection Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Threat Collection"]
  node_scheduler["Collection Scheduler<br/>[scheduler.py]"]
  node_rsscollector["RSS Collector<br/>[rss.py]"]
  node_ransomcollector["Ransomware Collector<br/>[ransomware_live.py]"]
  node_cvecollector["CVE Enrichment<br/>[cve_enrich.py]"]
end

subgraph group_analysis["Threat Analysis"]
  node_koreaanalyzer["Korea Classifier<br/>[korea.py]"]
  node_cveanalyzer["CVE Extractor<br/>[cve.py]"]
end

subgraph group_storage["Data and Queries"]
  node_models[("Domain Records<br/>[models.py]")]
  node_database[("SQL Database<br/>[extensions.py]")]
  node_articlequeries["News Queries<br/>[queries.py]"]
  node_ransomqueries["Ransomware Queries<br/>[ransom_queries.py]"]
  node_cvequeries["CVE Queries<br/>[cve_queries.py]"]
end

subgraph group_delivery["Alerts and Delivery"]
  node_alertengine["Alert Engine<br/>[engine.py]"]
  node_slackdelivery["Slack Delivery<br/>[slack.py]"]
end

subgraph group_web["Dashboard and API"]
  node_flaskapp["Flask Application<br/>[__init__.py]"]
  node_dashboard["Dashboard<br/>[dashboard.py]"]
  node_api["JSON API<br/>[api.py]"]
  node_alertviews["Alert Views<br/>[alerts.py]"]
  node_search["Unified Search<br/>[search.py]"]
end

node_operator(("Operator"))
node_rssfeeds[("Security RSS")]
node_ransomapi[("ransomware.live")]
node_nvd[("NVD, KEV, EPSS")]
node_slackservice(("Slack"))

node_scheduler -->|"runs collection"| node_rsscollector
node_scheduler -->|"runs collection"| node_ransomcollector
node_scheduler -->|"runs collection"| node_cvecollector
node_rsscollector -->|"fetches feeds"| node_rssfeeds
node_ransomcollector -->|"fetches victims"| node_ransomapi
node_cvecollector -->|"enriches CVEs"| node_nvd
node_rsscollector -->|"classifies articles"| node_koreaanalyzer
node_rsscollector -->|"extracts CVEs"| node_cveanalyzer
node_ransomcollector -->|"classifies victims"| node_koreaanalyzer
node_cvecollector -->|"labels vendors"| node_koreaanalyzer
node_rsscollector -->|"stores articles"| node_database
node_ransomcollector -->|"stores victims"| node_database
node_cvecollector -->|"stores enrichment"| node_database
node_models -->|"maps records"| node_database
node_articlequeries -->|"queries articles"| node_models
node_ransomqueries -->|"queries victims"| node_models
node_cvequeries -->|"queries CVEs"| node_models
node_scheduler -->|"evaluates alerts"| node_alertengine
node_alertengine -->|"sends pending"| node_slackdelivery
node_slackdelivery -->|"posts messages"| node_slackservice
node_flaskapp -->|"registers routes"| node_dashboard
node_flaskapp -->|"registers routes"| node_api
node_flaskapp -->|"registers routes"| node_alertviews
node_flaskapp -->|"registers routes"| node_search
node_dashboard -->|"reads news"| node_articlequeries
node_dashboard -->|"reads ransomware"| node_ransomqueries
node_dashboard -->|"reads CVEs"| node_cvequeries
node_api -->|"serves news"| node_articlequeries
node_api -->|"serves victims"| node_ransomqueries
node_api -->|"serves CVEs"| node_cvequeries
node_api -->|"runs alerts"| node_alertengine
node_alertviews -->|"runs evaluation"| node_alertengine
node_alertviews -->|"tests Slack"| node_slackdelivery
node_operator -->|"uses dashboard"| node_flaskapp
node_operator -->|"requests API"| node_api

click node_scheduler "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/scheduler.py"
click node_rsscollector "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/rss.py"
click node_ransomcollector "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/ransomware_live.py"
click node_cvecollector "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/cve_enrich.py"
click node_koreaanalyzer "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/analyzers/korea.py"
click node_cveanalyzer "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/analyzers/cve.py"
click node_models "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/models.py"
click node_database "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/extensions.py"
click node_articlequeries "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/queries.py"
click node_ransomqueries "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/ransom_queries.py"
click node_cvequeries "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/cve_queries.py"
click node_alertengine "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/alerts/engine.py"
click node_slackdelivery "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/alerts/slack.py"
click node_flaskapp "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/__init__.py"
click node_dashboard "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/dashboard.py"
click node_api "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/api.py"
click node_alertviews "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/alerts.py"
click node_search "https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/search.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_scheduler,node_rsscollector,node_ransomcollector,node_cvecollector toneBlue
class node_koreaanalyzer,node_cveanalyzer,node_rssfeeds,node_ransomapi,node_nvd toneAmber
class node_models,node_database,node_articlequeries,node_ransomqueries,node_cvequeries toneMint
class node_alertengine,node_slackdelivery toneRose
class node_flaskapp,node_dashboard,node_api,node_alertviews,node_search,node_operator,node_slackservice toneIndigo
```

## Components

### Threat Collection

- [Collection Scheduler](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/scheduler.py): `app/scheduler.py`
- [RSS Collector](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/rss.py): `app/collectors/rss.py`
- [Ransomware Collector](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/ransomware_live.py): `app/collectors/ransomware_live.py`
- [CVE Enrichment](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/collectors/cve_enrich.py): `app/collectors/cve_enrich.py`

### Threat Analysis

- [Korea Classifier](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/analyzers/korea.py): `app/analyzers/korea.py`
- [CVE Extractor](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/analyzers/cve.py): `app/analyzers/cve.py`

### Data and Queries

- [Domain Records](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/models.py): `app/models.py`
- [SQL Database](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/extensions.py): `app/extensions.py`
- [News Queries](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/queries.py): `app/queries.py`
- [Ransomware Queries](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/ransom_queries.py): `app/ransom_queries.py`
- [CVE Queries](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/cve_queries.py): `app/cve_queries.py`

### Alerts and Delivery

- [Alert Engine](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/alerts/engine.py): `app/alerts/engine.py`
- [Slack Delivery](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/alerts/slack.py): `app/alerts/slack.py`

### Dashboard and API

- [Flask Application](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/__init__.py): `app/__init__.py`
- [Dashboard](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/dashboard.py): `app/routes/dashboard.py`
- [JSON API](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/api.py): `app/routes/api.py`
- [Alert Views](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/alerts.py): `app/routes/alerts.py`
- [Unified Search](https://github.com/ngnicky-ai/kr-secwatch/blob/main/app/routes/search.py): `app/routes/search.py`

### Other components

- **Operator**
- **Security RSS**
- **ransomware.live**
- **NVD, KEV, EPSS**
- **Slack**

## Connections

- Collection Scheduler → RSS Collector: runs collection (evidence: `README.md`)
- Collection Scheduler → Ransomware Collector: runs collection (evidence: `README.md`)
- Collection Scheduler → CVE Enrichment: runs collection (evidence: `README.md`)
- RSS Collector → Security RSS: fetches feeds (evidence: `README.md`)
- Ransomware Collector → ransomware.live: fetches victims (evidence: `README.md`)
- CVE Enrichment → NVD, KEV, EPSS: enriches CVEs (evidence: `README.md`)
- RSS Collector → Korea Classifier: classifies articles (evidence: `app/collectors/rss.py`)
- RSS Collector → CVE Extractor: extracts CVEs (evidence: `app/collectors/rss.py`)
- Ransomware Collector → Korea Classifier: classifies victims (evidence: `app/collectors/ransomware_live.py`)
- CVE Enrichment → Korea Classifier: labels vendors (evidence: `app/collectors/cve_enrich.py`)
- RSS Collector → SQL Database: stores articles (evidence: `README.md`)
- Ransomware Collector → SQL Database: stores victims (evidence: `README.md`)
- CVE Enrichment → SQL Database: stores enrichment (evidence: `README.md`)
- Domain Records → SQL Database: maps records (evidence: `app/models.py`)
- News Queries → Domain Records: queries articles (evidence: `app/queries.py`)
- Ransomware Queries → Domain Records: queries victims (evidence: `app/ransom_queries.py`)
- CVE Queries → Domain Records: queries CVEs (evidence: `app/cve_queries.py`)
- Collection Scheduler → Alert Engine: evaluates alerts (evidence: `README.md`)
- Alert Engine → Slack Delivery: sends pending (evidence: `app/alerts/engine.py`)
- Slack Delivery → Slack: posts messages (evidence: `app/alerts/slack.py`)
- Flask Application → Dashboard: registers routes (evidence: `app/__init__.py`)
- Flask Application → JSON API: registers routes (evidence: `app/__init__.py`)
- Flask Application → Alert Views: registers routes (evidence: `app/__init__.py`)
- Flask Application → Unified Search: registers routes (evidence: `app/__init__.py`)
- Dashboard → News Queries: reads news (evidence: `app/routes/dashboard.py`)
- Dashboard → Ransomware Queries: reads ransomware (evidence: `app/routes/dashboard.py`)
- Dashboard → CVE Queries: reads CVEs (evidence: `app/routes/dashboard.py`)
- JSON API → News Queries: serves news (evidence: `app/routes/api.py`)
- JSON API → Ransomware Queries: serves victims (evidence: `app/routes/api.py`)
- JSON API → CVE Queries: serves CVEs (evidence: `app/routes/api.py`)
- JSON API → Alert Engine: runs alerts (evidence: `app/routes/api.py`)
- Alert Views → Alert Engine: runs evaluation (evidence: `app/routes/alerts.py`)
- Alert Views → Slack Delivery: tests Slack (evidence: `app/routes/alerts.py`)
- Operator → Flask Application: uses dashboard (evidence: `README.md`)
- Operator → JSON API: requests API (evidence: `README.md`)
