# reemaz06/verinews-ai architecture

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

- Interactive diagram: https://gitdiagram.com/reemaz06/verinews-ai
- Repository: https://github.com/reemaz06/verinews-ai

## Overview

VeriNews AI accepts article text, URLs, or documents, then returns a fake-news prediction, calibrated confidence, token-level explanations, and heuristic credibility indicators. Its API also exposes analysis history and analytics backed by SQLite. The graph includes the documented ingestion and inference stages plus distinct service modules present in the tree. Runtime wiring is supported where shown by excerpts or README; connections for unsampled modules are omitted rather than inferred.

Main entry points: [`app/main.py`](https://github.com/reemaz06/verinews-ai/blob/main/app/main.py) (FastAPI gateway), [`ml/explainability/explainer.py`](https://github.com/reemaz06/verinews-ai/blob/main/ml/explainability/explainer.py) (Text analysis), [`app/db/database.py`](https://github.com/reemaz06/verinews-ai/blob/main/app/db/database.py) (SQLite access), [`app/static/index.html`](https://github.com/reemaz06/verinews-ai/blob/main/app/static/index.html) (Web console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interface"]
  node_web_ui["Web console<br/>[index.html]"]
end

subgraph group_api["API and ingestion"]
  node_api_gateway["FastAPI gateway<br/>[main.py]"]
  node_url_ingest["URL extraction<br/>[url_extractor.py]"]
  node_file_ingest["File extraction<br/>[file_extractor.py]"]
end

subgraph group_analysis["Analysis services"]
  node_text_analysis["Text analysis<br/>[explainer.py]"]
  node_credibility["Credibility audit<br/>[credibility.py]"]
  node_similarity["Similarity check"]
  node_claims["Claims extraction"]
  node_headline["Headline analysis"]
  node_language["Language detection"]
  node_robustness["Robustness testing"]
  node_xai_runner["XAI evaluation<br/>[run_xai.py]"]
  node_preprocessing["Text preprocessing<br/>[preprocess.py]"]
end

subgraph group_state["Persistence and ML assets"]
  node_model["Classifier assets<br/>[best_model.joblib]"]
  node_database_layer["SQLite access<br/>[database.py]"]
  node_history_store[("Analysis history<br/>[verinews.db]")]
end

node_user(("Analyst"))

node_user -->|"submits article"| node_web_ui
node_web_ui -->|"calls REST API"| node_api_gateway
node_api_gateway -->|"extracts URL"| node_url_ingest
node_api_gateway -->|"extracts file"| node_file_ingest
node_api_gateway -->|"requests prediction"| node_text_analysis
node_api_gateway -->|"requests scoring"| node_credibility
node_api_gateway -->|"reads and writes"| node_database_layer
node_database_layer -->|"persists records"| node_history_store
node_similarity -->|"queries history"| node_database_layer
node_text_analysis -->|"loads model"| node_model
node_text_analysis -.->|"uses preprocessing"| node_preprocessing
node_xai_runner -->|"runs explanations"| node_text_analysis

click node_web_ui "https://github.com/reemaz06/verinews-ai/blob/main/app/static/index.html"
click node_api_gateway "https://github.com/reemaz06/verinews-ai/blob/main/app/main.py"
click node_url_ingest "https://github.com/reemaz06/verinews-ai/blob/main/app/services/url_extractor.py"
click node_file_ingest "https://github.com/reemaz06/verinews-ai/blob/main/app/services/file_extractor.py"
click node_text_analysis "https://github.com/reemaz06/verinews-ai/blob/main/ml/explainability/explainer.py"
click node_credibility "https://github.com/reemaz06/verinews-ai/blob/main/app/services/credibility.py"
click node_similarity "https://github.com/reemaz06/verinews-ai/blob/main/app/services/similarity_detector.py"
click node_claims "https://github.com/reemaz06/verinews-ai/blob/main/app/services/claims_extractor.py"
click node_headline "https://github.com/reemaz06/verinews-ai/blob/main/app/services/headline_analyzer.py"
click node_language "https://github.com/reemaz06/verinews-ai/blob/main/app/services/language_detector.py"
click node_robustness "https://github.com/reemaz06/verinews-ai/blob/main/app/services/robustness_tester.py"
click node_xai_runner "https://github.com/reemaz06/verinews-ai/blob/main/ml/explainability/run_xai.py"
click node_preprocessing "https://github.com/reemaz06/verinews-ai/blob/main/ml/preprocessing/preprocess.py"
click node_model "https://github.com/reemaz06/verinews-ai/blob/main/ml/models/best_model.joblib"
click node_database_layer "https://github.com/reemaz06/verinews-ai/blob/main/app/db/database.py"
click node_history_store "https://github.com/reemaz06/verinews-ai/blob/main/app/data/verinews.db"

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_web_ui toneBlue
class node_api_gateway,node_url_ingest,node_file_ingest toneAmber
class node_text_analysis,node_credibility,node_similarity,node_claims,node_headline,node_language,node_robustness,node_xai_runner,node_preprocessing toneMint
class node_model,node_database_layer,node_history_store toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Web console](https://github.com/reemaz06/verinews-ai/blob/main/app/static/index.html): `app/static/index.html`

### API and ingestion

- [FastAPI gateway](https://github.com/reemaz06/verinews-ai/blob/main/app/main.py): `app/main.py`
- [URL extraction](https://github.com/reemaz06/verinews-ai/blob/main/app/services/url_extractor.py): `app/services/url_extractor.py`
- [File extraction](https://github.com/reemaz06/verinews-ai/blob/main/app/services/file_extractor.py): `app/services/file_extractor.py`

### Analysis services

- [Text analysis](https://github.com/reemaz06/verinews-ai/blob/main/ml/explainability/explainer.py): `ml/explainability/explainer.py`
- [Credibility audit](https://github.com/reemaz06/verinews-ai/blob/main/app/services/credibility.py): `app/services/credibility.py`
- [Similarity check](https://github.com/reemaz06/verinews-ai/blob/main/app/services/similarity_detector.py): `app/services/similarity_detector.py`
- [Claims extraction](https://github.com/reemaz06/verinews-ai/blob/main/app/services/claims_extractor.py): `app/services/claims_extractor.py`
- [Headline analysis](https://github.com/reemaz06/verinews-ai/blob/main/app/services/headline_analyzer.py): `app/services/headline_analyzer.py`
- [Language detection](https://github.com/reemaz06/verinews-ai/blob/main/app/services/language_detector.py): `app/services/language_detector.py`
- [Robustness testing](https://github.com/reemaz06/verinews-ai/blob/main/app/services/robustness_tester.py): `app/services/robustness_tester.py`
- [XAI evaluation](https://github.com/reemaz06/verinews-ai/blob/main/ml/explainability/run_xai.py): `ml/explainability/run_xai.py`
- [Text preprocessing](https://github.com/reemaz06/verinews-ai/blob/main/ml/preprocessing/preprocess.py): `ml/preprocessing/preprocess.py`

### Persistence and ML assets

- [Classifier assets](https://github.com/reemaz06/verinews-ai/blob/main/ml/models/best_model.joblib): `ml/models/best_model.joblib`
- [SQLite access](https://github.com/reemaz06/verinews-ai/blob/main/app/db/database.py): `app/db/database.py`
- [Analysis history](https://github.com/reemaz06/verinews-ai/blob/main/app/data/verinews.db): `app/data/verinews.db`

### Other components

- **Analyst**

## Connections

- Analyst → Web console: submits article (evidence: `README.md`)
- Web console → FastAPI gateway: calls REST API (evidence: `README.md`)
- FastAPI gateway → URL extraction: extracts URL (evidence: `app/main.py`)
- FastAPI gateway → File extraction: extracts file (evidence: `app/main.py`)
- FastAPI gateway → Text analysis: requests prediction (evidence: `app/main.py`)
- FastAPI gateway → Credibility audit: requests scoring (evidence: `app/main.py`)
- FastAPI gateway → SQLite access: reads and writes (evidence: `app/main.py`)
- SQLite access → Analysis history: persists records (evidence: `app/db/database.py`)
- Similarity check → SQLite access: queries history (evidence: `app/services/similarity_detector.py`)
- Text analysis → Classifier assets: loads model (evidence: `README.md`)
- Text analysis → Text preprocessing: uses preprocessing
- XAI evaluation → Text analysis: runs explanations (evidence: `ml/explainability/run_xai.py`)
