# soundar-codes/cyber_shield_ai-final architecture

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

- Interactive diagram: https://gitdiagram.com/soundar-codes/cyber_shield_ai-final
- Repository: https://github.com/soundar-codes/cyber_shield_ai-final

## Overview

CyberShield AI is a browser-based scam and phishing protection system. Its principal workflow monitors WhatsApp Web and Gmail messages, checks them locally for suspicious patterns and through a Flask machine-learning API, then presents warnings in the page. The extension also provides user controls and can log detected threats to Firebase. The README documents the platform workflow; excerpts show the extension-to-API and background-to-Firebase calls. Model internals and some URL-blocking behavior are only partially evidenced, so those links are omitted.

Main entry points: [`extension/content.js`](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js) (Message scanning), [`extension/background.js`](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/background.js) (Detection coordinator), [`backend/app.py`](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/app.py) (Scam detection API), [`extension/firebase-config.js`](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/firebase-config.js) (Threat log client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Browser protection"]
  node_content["Message scanning<br/>[content.js]"]
  node_instant["Local pattern checks<br/>[content.js]"]
  node_warnings["Page warnings<br/>[content.js]"]
  node_background["Detection coordinator<br/>[background.js]"]
  node_popup["Settings and status<br/>[popup.js]"]
  node_url_blocker["URL click blocking"]
end

subgraph group_api["Detection services"]
  node_api["Scam detection API<br/>[app.py]"]
  node_classifier["Text classification<br/>[app.py]"]
  node_alternate_api["Alternate prediction API<br/>[app.py]"]
end

subgraph group_cloud["Threat logging"]
  node_firebase["Threat log client<br/>[firebase-config.js]"]
  node_firestore[("Threat log store")]
end

node_whatsapp(("WhatsApp Web"))
node_gmail(("Gmail"))

node_whatsapp -->|"provides messages"| node_content
node_gmail -->|"provides messages"| node_content
node_content -->|"checks locally"| node_instant
node_content -->|"requests analysis"| node_background
node_background -->|"sends message"| node_api
node_api -->|"vectorizes and predicts"| node_classifier
node_classifier -->|"returns prediction"| node_api
node_content -->|"highlights threats"| node_warnings
node_background -->|"sends alert"| node_warnings
node_popup -->|"requests status"| node_background
node_background -->|"logs threat"| node_firebase
node_firebase -->|"queries and writes"| node_firestore

click node_content "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js"
click node_instant "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js"
click node_warnings "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js"
click node_background "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/background.js"
click node_popup "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/popup.js"
click node_api "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/app.py"
click node_classifier "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/app.py"
click node_alternate_api "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/app.py"
click node_url_blocker "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/url_blocking_script.js"
click node_firebase "https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/firebase-config.js"

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_content,node_instant,node_warnings,node_background,node_popup,node_url_blocker toneBlue
class node_api,node_classifier,node_alternate_api toneAmber
class node_firebase,node_firestore toneMint
class node_whatsapp,node_gmail toneIndigo
```

## Components

### Browser protection

- [Message scanning](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js): `extension/content.js`
- [Local pattern checks](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js): `extension/content.js`
- [Page warnings](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/content.js): `extension/content.js`
- [Detection coordinator](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/background.js): `extension/background.js`
- [Settings and status](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/popup.js): `extension/popup.js`
- [URL click blocking](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/url_blocking_script.js): `backend/url_blocking_script.js`

### Detection services

- [Scam detection API](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/app.py): `backend/app.py`
- [Text classification](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/backend/app.py): `backend/app.py`
- [Alternate prediction API](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/app.py): `extension/app.py`

### Threat logging

- [Threat log client](https://github.com/soundar-codes/cyber_shield_ai-final/blob/main/extension/firebase-config.js): `extension/firebase-config.js`
- **Threat log store**

### Other components

- **WhatsApp Web**
- **Gmail**

## Connections

- WhatsApp Web → Message scanning: provides messages (evidence: `README.md`)
- Gmail → Message scanning: provides messages (evidence: `README.md`)
- Message scanning → Local pattern checks: checks locally (evidence: `extension/content.js`)
- Message scanning → Detection coordinator: requests analysis (evidence: `README.md`)
- Detection coordinator → Scam detection API: sends message (evidence: `extension/background.js`)
- Scam detection API → Text classification: vectorizes and predicts (evidence: `backend/app.py`)
- Text classification → Scam detection API: returns prediction (evidence: `backend/app.py`)
- Message scanning → Page warnings: highlights threats (evidence: `extension/content.js`)
- Detection coordinator → Page warnings: sends alert (evidence: `extension/background.js`)
- Settings and status → Detection coordinator: requests status (evidence: `extension/popup.js`)
- Detection coordinator → Threat log client: logs threat (evidence: `extension/background.js`)
- Threat log client → Threat log store: queries and writes (evidence: `extension/firebase-config.js`)
