# tenka04/antifake-video-detection architecture

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

- Interactive diagram: https://gitdiagram.com/tenka04/antifake-video-detection
- Repository: https://github.com/tenka04/antifake-video-detection

## Overview

AntiFake is a video-authenticity analysis product with a React dashboard, a FastAPI upload/URL-analysis API, persistent scan history, and a model inference runtime. The main workflow accepts a video in the Analyze page, sends it to the API, routes analysis to inference, and returns a verdict and detector results for display; dashboard and history pages fetch persisted data. The README describes a seven-detector ensemble, while the sampled runtime excerpt shows detector scoring and fusion but not every detector implementation. The graph preserves documented capabilities and marks relationships supported only by documentation accordingly.

Main entry points: [`frontend/src/services/api.ts`](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/services/api.ts) (API client), [`frontend/src/pages/Analyze.tsx`](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Analyze.tsx) (Analyze page), [`frontend/src/App.tsx`](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/App.tsx) (App routes), [`backend/app/main.py`](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/main.py) (FastAPI routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend_app["App routes<br/>[App.tsx]"]
  node_analyze_page["Analyze page<br/>[Analyze.tsx]"]
  node_video_inputs["Video inputs<br/>[VideoDropzone.tsx]"]
  node_video_preview["Video preview<br/>[VideoPreview.tsx]"]
  node_analysis_api["API client<br/>[api.ts]"]
  node_results["Analysis results<br/>[ResultCard.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_history_page["Scan history<br/>[History.tsx]"]
  node_settings["Theme settings<br/>[Settings.tsx]"]
end

subgraph group_gateway["API and history"]
  node_api_gateway["FastAPI routes<br/>[main.py]"]
  node_history_store[("SQLite history<br/>[database.py]")]
  node_model_client["Inference client<br/>[model_client.py]"]
end

subgraph group_inference["Video inference"]
  node_grpc_server["gRPC service<br/>[server.py]"]
  node_ensemble["Forensic detectors<br/>[poc_runtime.py]"]
  node_fusion["Score fusion<br/>[poc_runtime.py]"]
  node_videomae["VideoMAE detector"]
  node_video_inspection["Video inspection<br/>[video_loader.py]"]
  node_frame_sampling["Frame sampling<br/>[frame_sampler.py]"]
end

subgraph group_runtime["Standalone analysis"]
  node_gradio_app["Gradio interface<br/>[app.py]"]
  node_http_model["HTTP model server<br/>[http_server.py]"]
end

node_user(("Video analyst"))

node_user -->|"submits video"| node_analyze_page
node_analyze_page -->|"collects input"| node_video_inputs
node_analyze_page -->|"previews video"| node_video_preview
node_analyze_page -->|"requests analysis"| node_analysis_api
node_analysis_api -->|"sends REST request"| node_api_gateway
node_api_gateway -->|"routes analysis"| node_model_client
node_api_gateway -->|"records and queries"| node_history_store
node_model_client -->|"calls gRPC"| node_grpc_server
node_grpc_server -->|"runs analysis"| node_ensemble
node_ensemble -->|"fuses scores"| node_fusion
node_fusion -.->|"includes visual model"| node_videomae
node_videomae -->|"uses preprocessing"| node_video_inspection
node_frame_sampling -->|"reads video"| node_video_inspection
node_api_gateway -->|"returns result"| node_analysis_api
node_analysis_api -->|"provides results"| node_results
node_frontend_app -->|"routes to"| node_analyze_page
node_frontend_app -->|"routes to"| node_dashboard
node_frontend_app -->|"routes to"| node_history_page
node_frontend_app -->|"routes to"| node_settings
node_dashboard -->|"fetches statistics"| node_analysis_api
node_history_page -->|"fetches history"| node_analysis_api
node_user -.->|"runs standalone scan"| node_gradio_app
node_gradio_app -->|"uses runtime"| node_ensemble
node_http_model -->|"serves analysis"| node_ensemble

click node_frontend_app "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/App.tsx"
click node_analyze_page "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Analyze.tsx"
click node_video_inputs "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/video/VideoDropzone.tsx"
click node_video_preview "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/video/VideoPreview.tsx"
click node_analysis_api "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/services/api.ts"
click node_results "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/analysis/ResultCard.tsx"
click node_dashboard "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Dashboard.tsx"
click node_history_page "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/History.tsx"
click node_settings "https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Settings.tsx"
click node_api_gateway "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/main.py"
click node_history_store "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/database.py"
click node_model_client "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/model_client.py"
click node_grpc_server "https://github.com/tenka04/antifake-video-detection/blob/main/model/server.py"
click node_ensemble "https://github.com/tenka04/antifake-video-detection/blob/main/poc_runtime.py"
click node_fusion "https://github.com/tenka04/antifake-video-detection/blob/main/poc_runtime.py"
click node_videomae "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/models/videomae_detector.py"
click node_video_inspection "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/preprocessing/video_loader.py"
click node_frame_sampling "https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/preprocessing/frame_sampler.py"
click node_gradio_app "https://github.com/tenka04/antifake-video-detection/blob/main/app.py"
click node_http_model "https://github.com/tenka04/antifake-video-detection/blob/main/model/http_server.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_frontend_app,node_analyze_page,node_video_inputs,node_video_preview,node_analysis_api,node_results,node_dashboard,node_history_page,node_settings toneBlue
class node_api_gateway,node_history_store,node_model_client toneAmber
class node_grpc_server,node_ensemble,node_fusion,node_videomae,node_video_inspection,node_frame_sampling toneMint
class node_gradio_app,node_http_model toneRose
class node_user toneIndigo
```

## Components

### Web client

- [App routes](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Analyze page](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Analyze.tsx): `frontend/src/pages/Analyze.tsx`
- [Video inputs](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/video/VideoDropzone.tsx): `frontend/src/components/video/VideoDropzone.tsx`
- [Video preview](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/video/VideoPreview.tsx): `frontend/src/components/video/VideoPreview.tsx`
- [API client](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Analysis results](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/components/analysis/ResultCard.tsx): `frontend/src/components/analysis/ResultCard.tsx`
- [Dashboard](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Scan history](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/History.tsx): `frontend/src/pages/History.tsx`
- [Theme settings](https://github.com/tenka04/antifake-video-detection/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`

### API and history

- [FastAPI routes](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/main.py): `backend/app/main.py`
- [SQLite history](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/database.py): `backend/app/database.py`
- [Inference client](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/model_client.py): `backend/app/model_client.py`

### Video inference

- [gRPC service](https://github.com/tenka04/antifake-video-detection/blob/main/model/server.py): `model/server.py`
- [Forensic detectors](https://github.com/tenka04/antifake-video-detection/blob/main/poc_runtime.py): `poc_runtime.py`
- [Score fusion](https://github.com/tenka04/antifake-video-detection/blob/main/poc_runtime.py): `poc_runtime.py`
- [VideoMAE detector](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/models/videomae_detector.py): `backend/app/models/videomae_detector.py`
- [Video inspection](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/preprocessing/video_loader.py): `backend/app/preprocessing/video_loader.py`
- [Frame sampling](https://github.com/tenka04/antifake-video-detection/blob/main/backend/app/preprocessing/frame_sampler.py): `backend/app/preprocessing/frame_sampler.py`

### Standalone analysis

- [Gradio interface](https://github.com/tenka04/antifake-video-detection/blob/main/app.py): `app.py`
- [HTTP model server](https://github.com/tenka04/antifake-video-detection/blob/main/model/http_server.py): `model/http_server.py`

### Other components

- **Video analyst**

## Connections

- Video analyst → Analyze page: submits video (evidence: `README.md`)
- Analyze page → Video inputs: collects input (evidence: `frontend/src/pages/Analyze.tsx`)
- Analyze page → Video preview: previews video (evidence: `frontend/src/pages/Analyze.tsx`)
- Analyze page → API client: requests analysis (evidence: `frontend/src/pages/Analyze.tsx`)
- API client → FastAPI routes: sends REST request (evidence: `README.md`)
- FastAPI routes → Inference client: routes analysis (evidence: `backend/app/main.py`)
- FastAPI routes → SQLite history: records and queries (evidence: `backend/app/main.py`)
- Inference client → gRPC service: calls gRPC (evidence: `backend/app/model_client.py`)
- gRPC service → Forensic detectors: runs analysis (evidence: `model/server.py`)
- Forensic detectors → Score fusion: fuses scores (evidence: `poc_runtime.py`)
- Score fusion → VideoMAE detector: includes visual model (evidence: `README.md`)
- VideoMAE detector → Video inspection: uses preprocessing (evidence: `backend/app/models/videomae_detector.py`)
- Frame sampling → Video inspection: reads video (evidence: `backend/app/preprocessing/frame_sampler.py`)
- FastAPI routes → API client: returns result (evidence: `backend/app/main.py`)
- API client → Analysis results: provides results (evidence: `frontend/src/pages/Analyze.tsx`)
- App routes → Analyze page: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Scan history: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Theme settings: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard → API client: fetches statistics (evidence: `frontend/src/pages/Dashboard.tsx`)
- Scan history → API client: fetches history (evidence: `frontend/src/pages/History.tsx`)
- Video analyst → Gradio interface: runs standalone scan (evidence: `README.md`)
- Gradio interface → Forensic detectors: uses runtime (evidence: `app.py`)
- HTTP model server → Forensic detectors: serves analysis (evidence: `model/http_server.py`)
