# shri-ram8/scanbuzz architecture

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

- Interactive diagram: https://gitdiagram.com/shri-ram8/scanbuzz
- Repository: https://github.com/shri-ram8/scanbuzz

## Overview

TruthScan is a web fake-news detector. A user selects news or social content, submits text in the browser, and receives a verdict with confidence, per-model predictions, and clickbait signals. Flask validates the request, attempts a remote BERT prediction, and also runs local models; the local ensemble supplies the verdict if BERT is unavailable. The browser renders the response. The README documents health checking, though its `/api/health` path differs from the `/health` route in app.py. Unsampled HTML and model artifacts limit detail about their internals.

Main entry points: [`app.py`](https://github.com/shri-ram8/scanbuzz/blob/master/app.py) (Flask API), [`main.js`](https://github.com/shri-ram8/scanbuzz/blob/master/main.js) (Scanner interface), [`index.html`](https://github.com/shri-ram8/scanbuzz/blob/master/index.html) (Page shell), [`vec_word.pkl`](https://github.com/shri-ram8/scanbuzz/blob/master/vec_word.pkl) (Classical model files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser interface"]
  node_browser["Scanner interface<br/>[main.js]"]
  node_page["Page shell<br/>[index.html]"]
  node_results["Prediction display<br/>[main.js]"]
end

subgraph group_service["API service"]
  node_api["Flask API<br/>[app.py]"]
  node_health["Health endpoint<br/>[app.py]"]
end

subgraph group_inference["Inference"]
  node_features["Feature builder<br/>[app.py]"]
  node_local["Local classifiers<br/>[app.py]"]
  node_bert{{"Hugging Face BERT"}}
end

subgraph group_assets["Model assets"]
  node_artifacts["Classical model files<br/>[vec_word.pkl]"]
end

node_user(("User"))

node_user -->|"submits text"| node_browser
node_browser -->|"POSTs prediction"| node_api
node_api -->|"serves page"| node_page
node_api -->|"builds features"| node_features
node_features -->|"transforms with"| node_artifacts
node_api -->|"runs classifiers"| node_local
node_local -->|"predicts from"| node_features
node_api -.->|"requests prediction"| node_bert
node_api -->|"returns JSON"| node_results
node_results -->|"renders verdict"| node_browser

click node_browser "https://github.com/shri-ram8/scanbuzz/blob/master/main.js"
click node_page "https://github.com/shri-ram8/scanbuzz/blob/master/index.html"
click node_api "https://github.com/shri-ram8/scanbuzz/blob/master/app.py"
click node_features "https://github.com/shri-ram8/scanbuzz/blob/master/app.py"
click node_local "https://github.com/shri-ram8/scanbuzz/blob/master/app.py"
click node_artifacts "https://github.com/shri-ram8/scanbuzz/blob/master/vec_word.pkl"
click node_results "https://github.com/shri-ram8/scanbuzz/blob/master/main.js"
click node_health "https://github.com/shri-ram8/scanbuzz/blob/master/app.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_page,node_results,node_user toneBlue
class node_api,node_health toneAmber
class node_features,node_local,node_bert toneMint
class node_artifacts toneRose
```

## Components

### Browser interface

- [Scanner interface](https://github.com/shri-ram8/scanbuzz/blob/master/main.js): `main.js`
- [Page shell](https://github.com/shri-ram8/scanbuzz/blob/master/index.html): `index.html`
- [Prediction display](https://github.com/shri-ram8/scanbuzz/blob/master/main.js): `main.js`

### API service

- [Flask API](https://github.com/shri-ram8/scanbuzz/blob/master/app.py): `app.py`
- [Health endpoint](https://github.com/shri-ram8/scanbuzz/blob/master/app.py): `app.py`

### Inference

- [Feature builder](https://github.com/shri-ram8/scanbuzz/blob/master/app.py): `app.py`
- [Local classifiers](https://github.com/shri-ram8/scanbuzz/blob/master/app.py): `app.py`
- **Hugging Face BERT**

### Model assets

- [Classical model files](https://github.com/shri-ram8/scanbuzz/blob/master/vec_word.pkl): `vec_word.pkl`

### Other components

- **User**

## Connections

- User → Scanner interface: submits text (evidence: `main.js`)
- Scanner interface → Flask API: POSTs prediction (evidence: `main.js`)
- Flask API → Page shell: serves page (evidence: `app.py`)
- Flask API → Feature builder: builds features (evidence: `app.py`)
- Feature builder → Classical model files: transforms with (evidence: `app.py`)
- Flask API → Local classifiers: runs classifiers (evidence: `app.py`)
- Local classifiers → Feature builder: predicts from (evidence: `app.py`)
- Flask API → Hugging Face BERT: requests prediction (evidence: `app.py`)
- Flask API → Prediction display: returns JSON (evidence: `app.py`)
- Prediction display → Scanner interface: renders verdict (evidence: `main.js`)
