# akhan1502/news-evaluation-tool architecture

> Architecture diagram of the GitHub repository akhan1502/news-evaluation-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akhan1502/news-evaluation-tool
- Repository: https://github.com/akhan1502/news-evaluation-tool

## Overview

#### Purpose and Topology
NET is a news-credibility evaluation system: a browser extension extracts the current article, submits it for analysis, and presents reliability-oriented results. The repository contains three deployable concerns: a Chrome/Firefox extension, a React web client, and a Python API with SQLite persistence. A top-level bridge script may support extension-to-backend communication: `backend/extension_communicator.py`.

#### Browser Extension Entry and Capture
The extension is the primary in-page interaction surface. Its manifest defines browser integration and likely registers the content script: `news-extension/manifest.json`, `news-extension/manifest.chrome.json`, `news-extension/src/content-script.js`. The extension UI is bootstrapped through `news-extension/src/main.tsx` and composed in `news-extension/src/components/extension-app.tsx`.

#### Extension Analysis Presentation
The extension presents the credibility result rather than implementing analysis locally. Its UI components encode major result dimensions—criteria checks, score visualization, and sentiment display—at `news-extension/src/components/ui/criteria-check.tsx`, `news-extension/src/components/ui/gauge.tsx`, and `news-extension/src/components/ui/sentiment-chart.tsx`. Browser API abstractions and shared result types form the boundary between extension runtime APIs and application code: `news-extension/src/lib/browser.ts`, `news-extension/src/types/index.ts`.

#### API Boundary and Backend Entry
The Python backend is the analysis and persistence service, entered through `news-analyzer/backend/main.py`. News-specific HTTP endpoints are isolated in `news-analyzer/backend/routers/news.py`; request/response contracts are defined in `news-analyzer/backend/schemas.py`. Both the extension and web client contain dedicated API clients—`news-extension/src/lib/api.ts` and `news-analyzer/src/lib/api.ts`—which should be treated as the frontend/backend protocol boundary.

#### Domain Persistence
Backend domain entities and database setup are separated into `news-analyzer/backend/models.py` and `news-analyzer/backend/database.py`. SQLite database artifacts (`news-analyzer/backend/news.db`, `backend/news_analyzer.db`) indicate local-file persistence rather than managed external storage. Analysis requests flow from captured article content through the news router, domain models, and SQLite records, then return structured results to clients.

#### Web Client
`news-analyzer` is a separate Vite/React application, bootstrapped by `news-analyzer/src/main.tsx` and rooted at `news-analyzer/src/App.tsx`. It provides route-level experiences for analysis, authentication, home, and profile: `news-analyzer/src/routes/analyzer/page.tsx`, `news-analyzer/src/routes/auth/page.tsx`, `news-analyzer/src/routes/profile/page.tsx`. Authentication state is centralized in `news-analyzer/src/contexts/auth-context.tsx`, while protected-route enforcement is at `news-analyzer/src/components/protected-route.tsx`.

#### Runtimes and Key Boundaries
Frontend clients use TypeScript/React, Vite, Tailwind/PostCSS, and browser extension manifests. The service layer is Python with SQLite. The essential control flow is: browser page → extension content script/UI → API client → Python news router → database/models → structured analysis result → extension or web analyzer UI. The README describes AI-powered text comparison and credibility scoring, but no explicit AI-provider integration is visible in the supplied tree; it should remain an implementation boundary behind the backend API.

Main entry points: [`news-extension/src/components/extension-app.tsx`](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/components/extension-app.tsx) (Extension App), [`news-extension/src/lib/api.ts`](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/lib/api.ts) (Extension API Client), [`news-analyzer/backend/routers/news.py`](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/routers/news.py) (News Router), [`news-analyzer/src/App.tsx`](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/App.tsx) (Web App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Browser Extension"]
  node_manifest["Extension Manifests<br/>browser registration<br/>[manifest.json]"]
  node_content["Content Script<br/>article capture<br/>[content-script.js]"]
  node_extension_entry["Extension Entry<br/>React bootstrap<br/>[main.tsx]"]
  node_extension_ui["Extension App<br/>result UI<br/>[extension-app.tsx]"]
  node_result_views["Result Views<br/>criteria, gauge, sentiment<br/>[criteria-check.tsx]"]
  node_browser_boundary["Browser API Boundary<br/>browser abstraction<br/>[browser.ts]"]
  node_extension_api["Extension API Client<br/>backend protocol client<br/>[api.ts]"]
  node_types["Shared Result Types<br/>TypeScript contracts<br/>[index.ts]"]
end

subgraph group_backend["Python API"]
  node_api_entry["API Entry<br/>Python service<br/>[main.py]"]
  node_news_router["News Router<br/>analysis endpoints<br/>[news.py]"]
  node_schemas["API Schemas<br/>request/result contracts<br/>[schemas.py]"]
  node_domain["Domain Models<br/>analysis records<br/>[models.py]"]
  node_database[("SQLite Setup<br/>persistence layer<br/>[database.py]")]
  node_sqlite[("SQLite Records<br/>local database<br/>[news.db]")]
end

subgraph group_web["Web Client"]
  node_web_entry["Web Entry<br/>React bootstrap<br/>[main.tsx]"]
  node_web_app["Web App<br/>application root<br/>[App.tsx]"]
  node_analyzer["Analyzer Route<br/>analysis experience<br/>[page.tsx]"]
  node_web_api["Web API Client<br/>backend protocol client<br/>[api.ts]"]
  node_auth["Auth State<br/>authentication context<br/>[auth-context.tsx]"]
  node_protected["Protected Routes<br/>access enforcement"]
end

node_page["Browser Page<br/>article source"]

node_manifest -->|"registers"| node_content
node_manifest -->|"loads UI"| node_extension_entry
node_page -->|"article content"| node_content
node_content -->|"browser messaging"| node_browser_boundary
node_browser_boundary -->|"captured article"| node_extension_ui
node_extension_entry -->|"mounts"| node_extension_ui
node_extension_ui -->|"analysis request"| node_extension_api
node_extension_api -.->|"uses"| node_types
node_extension_api -->|"HTTP"| node_api_entry
node_api_entry -->|"routes"| node_news_router
node_news_router -->|"validates and returns"| node_schemas
node_news_router -->|"creates analysis records"| node_domain
node_domain -->|"persists through"| node_database
node_database -->|"stores"| node_sqlite
node_schemas -->|"structured result"| node_extension_ui
node_extension_ui -->|"renders"| node_result_views
node_web_entry -->|"mounts"| node_web_app
node_web_app -->|"analysis route"| node_analyzer
node_analyzer -->|"analysis request"| node_web_api
node_web_api -->|"HTTP"| node_api_entry
node_web_app -->|"provides state"| node_auth
node_auth -->|"authorizes"| node_protected

click node_manifest "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/manifest.json"
click node_content "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/content-script.js"
click node_extension_entry "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/main.tsx"
click node_extension_ui "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/components/extension-app.tsx"
click node_result_views "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/components/ui/criteria-check.tsx"
click node_browser_boundary "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/lib/browser.ts"
click node_extension_api "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/lib/api.ts"
click node_types "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/types/index.ts"
click node_api_entry "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/main.py"
click node_news_router "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/routers/news.py"
click node_schemas "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/schemas.py"
click node_domain "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/models.py"
click node_database "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/database.py"
click node_sqlite "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/news.db"
click node_web_entry "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/main.tsx"
click node_web_app "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/App.tsx"
click node_analyzer "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/routes/analyzer/page.tsx"
click node_web_api "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/lib/api.ts"
click node_auth "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/contexts/auth-context.tsx"
click node_protected "https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/components/protected-route.tsx"

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_manifest,node_content,node_extension_entry,node_extension_ui,node_result_views,node_browser_boundary,node_extension_api,node_types toneBlue
class node_api_entry,node_news_router,node_schemas,node_domain,node_database,node_sqlite toneAmber
class node_web_entry,node_web_app,node_analyzer,node_web_api,node_auth,node_protected toneMint
class node_page toneNeutral
```

## Components

### Browser Extension

In-page article capture and credibility result presentation.

- [Extension Manifests](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/manifest.json): browser registration · `news-extension/manifest.json`
- [Content Script](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/content-script.js): article capture · `news-extension/src/content-script.js`
- [Extension Entry](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/main.tsx): React bootstrap · `news-extension/src/main.tsx`
- [Extension App](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/components/extension-app.tsx): result UI · `news-extension/src/components/extension-app.tsx`
- [Result Views](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/components/ui/criteria-check.tsx): criteria, gauge, sentiment · Visualizes credibility dimensions. · `news-extension/src/components/ui/criteria-check.tsx`
- [Browser API Boundary](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/lib/browser.ts): browser abstraction · `news-extension/src/lib/browser.ts`
- [Extension API Client](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/lib/api.ts): backend protocol client · `news-extension/src/lib/api.ts`
- [Shared Result Types](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-extension/src/types/index.ts): TypeScript contracts · `news-extension/src/types/index.ts`

### Python API

Analysis and persistence boundary.

- [API Entry](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/main.py): Python service · `news-analyzer/backend/main.py`
- [News Router](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/routers/news.py): analysis endpoints · `news-analyzer/backend/routers/news.py`
- [API Schemas](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/schemas.py): request/result contracts · `news-analyzer/backend/schemas.py`
- [Domain Models](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/models.py): analysis records · `news-analyzer/backend/models.py`
- [SQLite Setup](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/database.py): persistence layer · `news-analyzer/backend/database.py`
- [SQLite Records](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/backend/news.db): local database · `news-analyzer/backend/news.db`

### Web Client

Separate React application for analysis and accounts.

- [Web Entry](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/main.tsx): React bootstrap · `news-analyzer/src/main.tsx`
- [Web App](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/App.tsx): application root · `news-analyzer/src/App.tsx`
- [Analyzer Route](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/routes/analyzer/page.tsx): analysis experience · `news-analyzer/src/routes/analyzer/page.tsx`
- [Web API Client](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/lib/api.ts): backend protocol client · `news-analyzer/src/lib/api.ts`
- [Auth State](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/contexts/auth-context.tsx): authentication context · `news-analyzer/src/contexts/auth-context.tsx`
- [Protected Routes](https://github.com/akhan1502/news-evaluation-tool/blob/main/news-analyzer/src/components/protected-route.tsx): access enforcement · `news-analyzer/src/components/protected-route.tsx`

### Other components

- **Browser Page**: article source

## Connections

- Extension Manifests → Content Script: registers
- Extension Manifests → Extension Entry: loads UI
- Browser Page → Content Script: article content
- Content Script → Browser API Boundary: browser messaging
- Browser API Boundary → Extension App: captured article
- Extension Entry → Extension App: mounts
- Extension App → Extension API Client: analysis request
- Extension API Client → Shared Result Types: uses
- Extension API Client → API Entry: HTTP
- API Entry → News Router: routes
- News Router → API Schemas: validates and returns
- News Router → Domain Models: creates analysis records
- Domain Models → SQLite Setup: persists through
- SQLite Setup → SQLite Records: stores
- API Schemas → Extension App: structured result
- Extension App → Result Views: renders
- Web Entry → Web App: mounts
- Web App → Analyzer Route: analysis route
- Analyzer Route → Web API Client: analysis request
- Web API Client → API Entry: HTTP
- Web App → Auth State: provides state
- Auth State → Protected Routes: authorizes
