# gshashen/verif-ai architecture

> Architecture diagram of the GitHub repository gshashen/verif-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gshashen/verif-ai
- Repository: https://github.com/gshashen/verif-ai

## Overview

VerifAI accepts a URL or pasted text and returns sourced, confidence-rated claim verdicts. The main path runs from the React submission through FastAPI extraction, claim generation, evidence search and stance evaluation; Python applies the verdict rule. Results include source evidence and partial-stage errors. The README documents extraction fallbacks and search/evaluation behavior beyond the sampled excerpts; those capabilities are represented, with edges grounded in the README or shown caller references. No database is described.

Main entry points: [`frontend/src/App.jsx`](https://github.com/gshashen/verif-ai/blob/main/frontend/src/App.jsx) (App workflow), [`backend/main.py`](https://github.com/gshashen/verif-ai/blob/main/backend/main.py) (FastAPI endpoints), [`backend/search.py`](https://github.com/gshashen/verif-ai/blob/main/backend/search.py) (Evidence search), [`backend/models.py`](https://github.com/gshashen/verif-ai/blob/main/backend/models.py) (Validated models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_app["App workflow<br/>[App.jsx]"]
  node_input_validation["Input validation<br/>[validate.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_landing_form["Submission form<br/>[LandingForm.jsx]"]
  node_loading_stage["Loading display<br/>[LoadingStage.jsx]"]
  node_results_view["Results summary<br/>[ResultsView.jsx]"]
  node_claim_details["Claim details<br/>[ClaimAccordion.jsx]"]
  node_disputed_tabs["Disputed sources<br/>[DisputedTabs.jsx]"]
  node_source_list["Evidence sources<br/>[SourceList.jsx]"]
  node_verdict_badges["Verdict badges<br/>[badges.jsx]"]
  node_verdict_labels["Verdict labels<br/>[verdicts.js]"]
  node_toast["Error notices<br/>[Toast.jsx]"]
end

subgraph group_backend["API orchestration"]
  node_api["FastAPI endpoints<br/>[main.py]"]
end

subgraph group_pipeline["Verification pipeline"]
  node_extractor["Text extraction<br/>[extractor.py]"]
  node_claim_extraction["Claim generation<br/>[claims.py]"]
  node_source_search["Evidence search<br/>[search.py]"]
  node_trust_tiers["Trust ranking<br/>[tiers.py]"]
  node_evaluation["Stance and verdict<br/>[evaluator.py]"]
end

subgraph group_contracts["Data contracts"]
  node_schemas["Validated models<br/>[models.py]"]
end

node_user(("User"))
node_anthropic{{"Anthropic API"}}
node_serper{{"Serper search"}}
node_web_pages{{"Source websites"}}

node_user -->|"submits input"| node_landing_form
node_landing_form -->|"submits"| node_app
node_app -->|"validates input"| node_input_validation
node_app -->|"requests verification"| node_api_client
node_app -->|"shows progress"| node_loading_stage
node_app -->|"displays result"| node_results_view
node_app -->|"shows errors"| node_toast
node_api_client -->|"POST /verify"| node_api
node_api -->|"extracts text"| node_extractor
node_api -->|"extracts claims"| node_claim_extraction
node_api -->|"searches claims"| node_source_search
node_api -->|"evaluates sources"| node_evaluation
node_claim_extraction -->|"generates claims"| node_anthropic
node_source_search -->|"queries web"| node_serper
node_source_search -->|"fetches pages"| node_web_pages
node_source_search -->|"assigns tiers"| node_trust_tiers
node_evaluation -->|"labels stances"| node_anthropic
node_api -->|"validates requests"| node_schemas
node_claim_extraction -->|"validates claims"| node_schemas
node_source_search -->|"builds sources"| node_schemas
node_evaluation -->|"returns claim data"| node_schemas
node_results_view -->|"renders claims"| node_claim_details
node_claim_details -->|"renders disputed views"| node_disputed_tabs
node_claim_details -->|"renders sources"| node_source_list
node_source_list -->|"renders tier and stance"| node_verdict_badges
node_results_view -->|"maps verdict labels"| node_verdict_labels
node_verdict_badges -->|"maps badge labels"| node_verdict_labels

click node_app "https://github.com/gshashen/verif-ai/blob/main/frontend/src/App.jsx"
click node_input_validation "https://github.com/gshashen/verif-ai/blob/main/frontend/src/lib/validate.js"
click node_api_client "https://github.com/gshashen/verif-ai/blob/main/frontend/src/api.js"
click node_landing_form "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/LandingForm.jsx"
click node_loading_stage "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/LoadingStage.jsx"
click node_results_view "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/ResultsView.jsx"
click node_claim_details "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/ClaimAccordion.jsx"
click node_disputed_tabs "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/DisputedTabs.jsx"
click node_source_list "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/SourceList.jsx"
click node_verdict_badges "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/badges.jsx"
click node_verdict_labels "https://github.com/gshashen/verif-ai/blob/main/frontend/src/lib/verdicts.js"
click node_toast "https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/Toast.jsx"
click node_api "https://github.com/gshashen/verif-ai/blob/main/backend/main.py"
click node_extractor "https://github.com/gshashen/verif-ai/blob/main/backend/extractor.py"
click node_claim_extraction "https://github.com/gshashen/verif-ai/blob/main/backend/claims.py"
click node_source_search "https://github.com/gshashen/verif-ai/blob/main/backend/search.py"
click node_trust_tiers "https://github.com/gshashen/verif-ai/blob/main/backend/tiers.py"
click node_evaluation "https://github.com/gshashen/verif-ai/blob/main/backend/evaluator.py"
click node_schemas "https://github.com/gshashen/verif-ai/blob/main/backend/models.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_input_validation,node_api_client,node_landing_form,node_loading_stage,node_results_view,node_claim_details,node_disputed_tabs,node_source_list,node_verdict_badges,node_verdict_labels,node_toast,node_user toneBlue
class node_api toneAmber
class node_extractor,node_claim_extraction,node_source_search,node_trust_tiers,node_evaluation,node_anthropic toneMint
class node_schemas toneRose
class node_serper,node_web_pages toneIndigo
```

## Components

### User interface

- [App workflow](https://github.com/gshashen/verif-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Input validation](https://github.com/gshashen/verif-ai/blob/main/frontend/src/lib/validate.js): `frontend/src/lib/validate.js`
- [API client](https://github.com/gshashen/verif-ai/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Submission form](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/LandingForm.jsx): `frontend/src/components/LandingForm.jsx`
- [Loading display](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/LoadingStage.jsx): `frontend/src/components/LoadingStage.jsx`
- [Results summary](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/ResultsView.jsx): `frontend/src/components/ResultsView.jsx`
- [Claim details](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/ClaimAccordion.jsx): `frontend/src/components/ClaimAccordion.jsx`
- [Disputed sources](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/DisputedTabs.jsx): `frontend/src/components/DisputedTabs.jsx`
- [Evidence sources](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/SourceList.jsx): `frontend/src/components/SourceList.jsx`
- [Verdict badges](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/badges.jsx): `frontend/src/components/badges.jsx`
- [Verdict labels](https://github.com/gshashen/verif-ai/blob/main/frontend/src/lib/verdicts.js): `frontend/src/lib/verdicts.js`
- [Error notices](https://github.com/gshashen/verif-ai/blob/main/frontend/src/components/Toast.jsx): `frontend/src/components/Toast.jsx`

### API orchestration

- [FastAPI endpoints](https://github.com/gshashen/verif-ai/blob/main/backend/main.py): `backend/main.py`

### Verification pipeline

- [Text extraction](https://github.com/gshashen/verif-ai/blob/main/backend/extractor.py): `backend/extractor.py`
- [Claim generation](https://github.com/gshashen/verif-ai/blob/main/backend/claims.py): `backend/claims.py`
- [Evidence search](https://github.com/gshashen/verif-ai/blob/main/backend/search.py): `backend/search.py`
- [Trust ranking](https://github.com/gshashen/verif-ai/blob/main/backend/tiers.py): `backend/tiers.py`
- [Stance and verdict](https://github.com/gshashen/verif-ai/blob/main/backend/evaluator.py): `backend/evaluator.py`

### Data contracts

- [Validated models](https://github.com/gshashen/verif-ai/blob/main/backend/models.py): `backend/models.py`

### Other components

- **User**
- **Anthropic API**
- **Serper search**
- **Source websites**

## Connections

- User → Submission form: submits input (evidence: `README.md`)
- Submission form → App workflow: submits (evidence: `frontend/src/App.jsx`)
- App workflow → Input validation: validates input (evidence: `frontend/src/App.jsx`)
- App workflow → API client: requests verification (evidence: `frontend/src/App.jsx`)
- App workflow → Loading display: shows progress (evidence: `frontend/src/App.jsx`)
- App workflow → Results summary: displays result (evidence: `frontend/src/App.jsx`)
- App workflow → Error notices: shows errors (evidence: `frontend/src/App.jsx`)
- API client → FastAPI endpoints: POST /verify (evidence: `frontend/src/api.js`)
- FastAPI endpoints → Text extraction: extracts text (evidence: `backend/main.py`)
- FastAPI endpoints → Claim generation: extracts claims (evidence: `backend/main.py`)
- FastAPI endpoints → Evidence search: searches claims (evidence: `backend/main.py`)
- FastAPI endpoints → Stance and verdict: evaluates sources (evidence: `backend/main.py`)
- Claim generation → Anthropic API: generates claims (evidence: `README.md`)
- Evidence search → Serper search: queries web (evidence: `backend/search.py`)
- Evidence search → Source websites: fetches pages (evidence: `backend/search.py`)
- Evidence search → Trust ranking: assigns tiers (evidence: `backend/search.py`)
- Stance and verdict → Anthropic API: labels stances (evidence: `README.md`)
- FastAPI endpoints → Validated models: validates requests (evidence: `backend/main.py`)
- Claim generation → Validated models: validates claims (evidence: `backend/claims.py`)
- Evidence search → Validated models: builds sources (evidence: `backend/search.py`)
- Stance and verdict → Validated models: returns claim data (evidence: `backend/evaluator.py`)
- Results summary → Claim details: renders claims (evidence: `frontend/src/components/ResultsView.jsx`)
- Claim details → Disputed sources: renders disputed views (evidence: `frontend/src/components/ClaimAccordion.jsx`)
- Claim details → Evidence sources: renders sources (evidence: `frontend/src/components/ClaimAccordion.jsx`)
- Evidence sources → Verdict badges: renders tier and stance (evidence: `frontend/src/components/SourceList.jsx`)
- Results summary → Verdict labels: maps verdict labels (evidence: `frontend/src/components/ResultsView.jsx`)
- Verdict badges → Verdict labels: maps badge labels (evidence: `frontend/src/components/badges.jsx`)
