# vamsikrishna308/deepfake-defender architecture

> Architecture diagram of the GitHub repository vamsikrishna308/deepfake-defender, 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/vamsikrishna308/deepfake-defender
- Repository: https://github.com/vamsikrishna308/deepfake-defender

## Overview

DeepFake Defender is a web application for examining media for signs of manipulation. Users select a dashboard, image/video upload, batch-image, or live-camera view; the upload interface submits analysis requests, and the backend runs inference and can retain results for history and reporting. The dashboard fetches analytics and detection history, while single-file results offer PDF and CSV exports. Batch analysis is currently simulated in the sampled component, and the live-camera view describes local processing. The README also documents CNN/ViT training; the sampled inference path instead describes forensic image analysis and mock video simulation.

Main entry points: [`frontend/src/App.jsx`](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/App.jsx) (App navigation), [`backend/main.py`](https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/main.py) (REST API), [`frontend/src/components/UploadSection.jsx`](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/UploadSection.jsx) (Media upload), [`frontend/src/components/LiveCamera.jsx`](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/LiveCamera.jsx) (Live camera)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App navigation<br/>[App.jsx]"]
  node_upload["Media upload<br/>[UploadSection.jsx]"]
  node_batch["Batch analysis<br/>[BatchAnalysis.jsx]"]
  node_live["Live camera<br/>[LiveCamera.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_service["Detection service"]
  node_api["REST API<br/>[main.py]"]
end

subgraph group_ml["Analysis and training"]
  node_inference["Media inference<br/>[inference.py]"]
  node_model["CNN ViT model<br/>[model.py]"]
  node_training["Model training<br/>[train.py]"]
end

subgraph group_state["Detection records"]
  node_records[("Detection history<br/>[models.py]")]
  node_database[("SQLite session<br/>[database.py]")]
end

node_user(("Analyst"))
node_browser(("Browser"))

node_user -->|"uses"| node_browser
node_browser -->|"loads"| node_app
node_app -->|"selects"| node_upload
node_app -->|"selects"| node_batch
node_app -->|"selects"| node_live
node_app -->|"selects"| node_dashboard
node_upload -.->|"submits media"| node_api
node_dashboard -->|"fetches analytics"| node_api
node_api -->|"runs prediction"| node_inference
node_api -->|"queries and saves"| node_records
node_records -->|"uses base"| node_database
node_api -->|"returns reports"| node_browser
node_live -.->|"processes locally"| node_browser
node_training -.->|"trains"| node_model

click node_app "https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/App.jsx"
click node_upload "https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/UploadSection.jsx"
click node_batch "https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/BatchAnalysis.jsx"
click node_live "https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/LiveCamera.jsx"
click node_dashboard "https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/Dashboard.jsx"
click node_api "https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/main.py"
click node_inference "https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/inference.py"
click node_model "https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/model.py"
click node_training "https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/train.py"
click node_records "https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/models.py"
click node_database "https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/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_app,node_upload,node_batch,node_live,node_dashboard,node_browser toneBlue
class node_api toneAmber
class node_inference,node_model,node_training toneMint
class node_records,node_database toneRose
class node_user toneIndigo
```

## Components

### Web client

- [App navigation](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Media upload](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/UploadSection.jsx): `frontend/src/components/UploadSection.jsx`
- [Batch analysis](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/BatchAnalysis.jsx): `frontend/src/components/BatchAnalysis.jsx`
- [Live camera](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/LiveCamera.jsx): `frontend/src/components/LiveCamera.jsx`
- [Dashboard](https://github.com/vamsikrishna308/deepfake-defender/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`

### Detection service

- [REST API](https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/main.py): `backend/main.py`

### Analysis and training

- [Media inference](https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/inference.py): `ml/inference.py`
- [CNN ViT model](https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/model.py): `ml/model.py`
- [Model training](https://github.com/vamsikrishna308/deepfake-defender/blob/main/ml/train.py): `ml/train.py`

### Detection records

- [Detection history](https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/models.py): `backend/models.py`
- [SQLite session](https://github.com/vamsikrishna308/deepfake-defender/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Analyst**
- **Browser**

## Connections

- Analyst → Browser: uses (evidence: `README.md`)
- Browser → App navigation: loads
- App navigation → Media upload: selects (evidence: `frontend/src/App.jsx`)
- App navigation → Batch analysis: selects (evidence: `frontend/src/App.jsx`)
- App navigation → Live camera: selects (evidence: `frontend/src/App.jsx`)
- App navigation → Dashboard: selects (evidence: `frontend/src/App.jsx`)
- Media upload → REST API: submits media
- Dashboard → REST API: fetches analytics (evidence: `frontend/src/components/Dashboard.jsx`)
- REST API → Media inference: runs prediction (evidence: `backend/main.py`)
- REST API → Detection history: queries and saves (evidence: `backend/main.py`)
- Detection history → SQLite session: uses base (evidence: `backend/models.py`)
- REST API → Browser: returns reports (evidence: `backend/main.py`)
- Live camera → Browser: processes locally
- Model training → CNN ViT model: trains
