# mr-chetan-66/viralens_ai architecture

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

- Interactive diagram: https://gitdiagram.com/mr-chetan-66/viralens_ai
- Repository: https://github.com/mr-chetan-66/viralens_ai

## Overview

ViraLens AI accepts typed text or an image, extracts and classifies factual claims, searches sources, evaluates evidence, computes a verdict and confidence, and presents a plain-language report with citations. The backend orchestration and major verification stages are represented alongside the React interface and OCR. The excerpts show the pipeline’s internal calls; API-to-UI wiring and some search-provider dispatch details were not shown, so those connections are omitted.

Main entry points: [`utils.py`](https://github.com/mr-chetan-66/viralens_ai/blob/main/utils.py) (Pipeline orchestration), [`llm.py`](https://github.com/mr-chetan-66/viralens_ai/blob/main/llm.py) (LLM client configuration), [`frontend/src/App.jsx`](https://github.com/mr-chetan-66/viralens_ai/blob/main/frontend/src/App.jsx) (Fact-check UI), [`api.py`](https://github.com/mr-chetan-66/viralens_ai/blob/main/api.py) (Backend API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["Fact-check UI<br/>[App.jsx]"]
  node_api["Backend API<br/>[api.py]"]
end

subgraph group_intake["Claim intake"]
  node_pipeline["Pipeline orchestration<br/>[utils.py]"]
  node_ocr["Image OCR<br/>[ocr.py]"]
  node_claim_extract["Claim extraction<br/>[claim_extractor.py]"]
end

subgraph group_verification["Evidence verification"]
  node_search["Source search and ranking<br/>[search_engine.py]"]
  node_evaluation["Evidence evaluation<br/>[evaluator.py]"]
end

subgraph group_reporting["Verdict and reporting"]
  node_verdict["Verdict and confidence<br/>[verdict.py]"]
  node_report["Plain-language report<br/>[reporter.py]"]
end

subgraph group_shared["Shared services"]
  node_cancellation["Cancellation checks<br/>[cancellation.py]"]
  node_llm_config["LLM client configuration<br/>[llm.py]"]
end

node_user(("User"))
node_groq{{"Groq inference"}}
node_search_services{{"Web search services"}}

node_user -->|"submits claim"| node_webapp
node_webapp -.->|"requests checks"| node_api
node_api -.->|"delegates processing"| node_pipeline
node_pipeline -->|"checks cancellation"| node_cancellation
node_pipeline -->|"classifies claims"| node_claim_extract
node_pipeline -->|"extracts image text"| node_ocr
node_pipeline -->|"searches sources"| node_search
node_pipeline -->|"evaluates evidence"| node_evaluation
node_pipeline -->|"computes verdict"| node_verdict
node_pipeline -->|"builds report"| node_report
node_claim_extract -->|"gets client"| node_llm_config
node_evaluation -->|"gets client"| node_llm_config
node_report -->|"gets client"| node_llm_config
node_ocr -->|"transcribes image"| node_groq
node_search -.->|"queries providers"| node_search_services
node_llm_config -.->|"configures client"| node_groq

click node_webapp "https://github.com/mr-chetan-66/viralens_ai/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/mr-chetan-66/viralens_ai/blob/main/api.py"
click node_pipeline "https://github.com/mr-chetan-66/viralens_ai/blob/main/utils.py"
click node_ocr "https://github.com/mr-chetan-66/viralens_ai/blob/main/ocr.py"
click node_claim_extract "https://github.com/mr-chetan-66/viralens_ai/blob/main/claim_extractor.py"
click node_search "https://github.com/mr-chetan-66/viralens_ai/blob/main/search_engine.py"
click node_evaluation "https://github.com/mr-chetan-66/viralens_ai/blob/main/evaluator.py"
click node_verdict "https://github.com/mr-chetan-66/viralens_ai/blob/main/verdict.py"
click node_report "https://github.com/mr-chetan-66/viralens_ai/blob/main/reporter.py"
click node_cancellation "https://github.com/mr-chetan-66/viralens_ai/blob/main/cancellation.py"
click node_llm_config "https://github.com/mr-chetan-66/viralens_ai/blob/main/llm.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_webapp,node_api,node_user toneBlue
class node_pipeline,node_ocr,node_claim_extract toneAmber
class node_search,node_evaluation toneMint
class node_verdict,node_report toneRose
class node_cancellation,node_llm_config,node_groq,node_search_services toneIndigo
```

## Components

### User experience

- [Fact-check UI](https://github.com/mr-chetan-66/viralens_ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Backend API](https://github.com/mr-chetan-66/viralens_ai/blob/main/api.py): `api.py`

### Claim intake

- [Pipeline orchestration](https://github.com/mr-chetan-66/viralens_ai/blob/main/utils.py): `utils.py`
- [Image OCR](https://github.com/mr-chetan-66/viralens_ai/blob/main/ocr.py): `ocr.py`
- [Claim extraction](https://github.com/mr-chetan-66/viralens_ai/blob/main/claim_extractor.py): `claim_extractor.py`

### Evidence verification

- [Source search and ranking](https://github.com/mr-chetan-66/viralens_ai/blob/main/search_engine.py): `search_engine.py`
- [Evidence evaluation](https://github.com/mr-chetan-66/viralens_ai/blob/main/evaluator.py): `evaluator.py`

### Verdict and reporting

- [Verdict and confidence](https://github.com/mr-chetan-66/viralens_ai/blob/main/verdict.py): `verdict.py`
- [Plain-language report](https://github.com/mr-chetan-66/viralens_ai/blob/main/reporter.py): `reporter.py`

### Shared services

- [Cancellation checks](https://github.com/mr-chetan-66/viralens_ai/blob/main/cancellation.py): `cancellation.py`
- [LLM client configuration](https://github.com/mr-chetan-66/viralens_ai/blob/main/llm.py): `llm.py`

### Other components

- **User**
- **Groq inference**
- **Web search services**

## Connections

- User → Fact-check UI: submits claim (evidence: `README.md`)
- Fact-check UI → Backend API: requests checks
- Backend API → Pipeline orchestration: delegates processing (evidence: `api.py`)
- Pipeline orchestration → Cancellation checks: checks cancellation (evidence: `utils.py`)
- Pipeline orchestration → Claim extraction: classifies claims (evidence: `utils.py`)
- Pipeline orchestration → Image OCR: extracts image text (evidence: `utils.py`)
- Pipeline orchestration → Source search and ranking: searches sources (evidence: `utils.py`)
- Pipeline orchestration → Evidence evaluation: evaluates evidence (evidence: `utils.py`)
- Pipeline orchestration → Verdict and confidence: computes verdict (evidence: `utils.py`)
- Pipeline orchestration → Plain-language report: builds report (evidence: `utils.py`)
- Claim extraction → LLM client configuration: gets client (evidence: `claim_extractor.py`)
- Evidence evaluation → LLM client configuration: gets client (evidence: `evaluator.py`)
- Plain-language report → LLM client configuration: gets client (evidence: `reporter.py`)
- Image OCR → Groq inference: transcribes image (evidence: `ocr.py`)
- Source search and ranking → Web search services: queries providers
- LLM client configuration → Groq inference: configures client
