# ashwini1779/thedigest-ai--news-aggregator architecture

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

- Interactive diagram: https://gitdiagram.com/ashwini1779/thedigest-ai--news-aggregator
- Repository: https://github.com/ashwini1779/thedigest-ai--news-aggregator

## Overview

The Digest lets readers discover live news, save articles, then summarize, export, or index saved stories for cited RAG answers. The graph follows the documented UI/API workflow and the sampled service ownership; several backend feature links are supported by the README but their router/service source was not sampled, so those internal call details are not expanded.

Main entry points: [`frontend/src/router.tsx`](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/router.tsx) (Web app), [`frontend/src/lib/api.ts`](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/lib/api.ts) (API client), [`backend/main.py`](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/main.py) (FastAPI app), [`backend/app/routers/ai.py`](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/ai.py) (AI routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Reader interface"]
  node_frontend["Web app<br/>[router.tsx]"]
  node_discover["Discover feed<br/>[index.tsx]"]
  node_searchpage["News search<br/>[search.tsx]"]
  node_publisherpage["Publisher browse<br/>[publisher.tsx]"]
  node_savedpage["Saved library<br/>[saved.tsx]"]
  node_askpage["Ask AI<br/>[ask.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["FastAPI app<br/>[main.py]"]
  node_news_routes["News routes<br/>[news.py]"]
  node_article_routes["Article routes<br/>[articles.py]"]
  node_ai_routes["AI routes<br/>[ai.py]"]
  node_health_routes["Health routes<br/>[health.py]"]
end

subgraph group_news["News discovery"]
  node_news_service["News normalization<br/>[news_service.py]"]
  node_news_repo["Provider access<br/>[news_repository.py]"]
end

subgraph group_library["Saved articles"]
  node_article_service["Article operations<br/>[article_service.py]"]
  node_article_repo["Article persistence"]
  node_article_db[("PostgreSQL<br/>[article.py]")]
end

subgraph group_ai["AI and exports"]
  node_chunk["Text chunking<br/>[chunk_service.py]"]
  node_embedding["Local embeddings"]
  node_vector[("FAISS index<br/>[vector_store.py]")]
  node_retrieval["RAG retrieval<br/>[search_service.py]"]
  node_gemini["Gemini generation<br/>[gemini_service.py]"]
  node_pdf["PDF generation<br/>[pdf_service.py]"]
end

node_reader(("Reader"))
node_news_provider{{"News providers"}}
node_gemini_api{{"Gemini API"}}
node_pdf_file["Generated PDF"]

node_reader -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_discover
node_frontend -->|"routes to"| node_searchpage
node_frontend -->|"routes to"| node_publisherpage
node_frontend -->|"routes to"| node_savedpage
node_frontend -->|"routes to"| node_askpage
node_discover -->|"requests headlines"| node_api_client
node_searchpage -->|"searches news"| node_api_client
node_publisherpage -->|"requests publisher"| node_api_client
node_savedpage -->|"manages articles"| node_api_client
node_askpage -->|"submits questions"| node_api_client
node_api_client -->|"REST JSON"| node_backend
node_backend -->|"dispatches"| node_news_routes
node_backend -->|"dispatches"| node_article_routes
node_backend -->|"dispatches"| node_ai_routes
node_backend -->|"dispatches"| node_health_routes
node_news_routes -->|"handles news"| node_news_service
node_news_service -->|"fetches data"| node_news_repo
node_news_repo -->|"requests"| node_news_provider
node_article_routes -->|"handles articles"| node_article_service
node_article_service -->|"persists articles"| node_article_repo
node_article_repo -->|"reads and writes"| node_article_db
node_ai_routes -->|"indexes text"| node_chunk
node_chunk -->|"chunks embedded"| node_embedding
node_embedding -->|"adds vectors"| node_vector
node_ai_routes -->|"retrieves context"| node_retrieval
node_retrieval -->|"embeds question"| node_embedding
node_retrieval -->|"searches vectors"| node_vector
node_ai_routes -->|"generates answers"| node_gemini
node_gemini -->|"calls"| node_gemini_api
node_article_routes -->|"exports article"| node_pdf
node_pdf -->|"writes PDF"| node_pdf_file

click node_frontend "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/router.tsx"
click node_discover "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/index.tsx"
click node_searchpage "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/search.tsx"
click node_publisherpage "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/publisher.tsx"
click node_savedpage "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/saved.tsx"
click node_askpage "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/ask.tsx"
click node_api_client "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/lib/api.ts"
click node_backend "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/main.py"
click node_news_routes "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/news.py"
click node_article_routes "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/articles.py"
click node_ai_routes "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/ai.py"
click node_health_routes "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/health.py"
click node_news_service "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/news_service.py"
click node_news_repo "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/repositories/news_repository.py"
click node_article_service "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/article_service.py"
click node_article_repo "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/repositories/article_repository.py"
click node_article_db "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/models/article.py"
click node_chunk "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/chunk_service.py"
click node_embedding "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/embedding_service.py"
click node_vector "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/vector_store.py"
click node_retrieval "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/search_service.py"
click node_gemini "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/gemini_service.py"
click node_pdf "https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/pdf_service.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,node_discover,node_searchpage,node_publisherpage,node_savedpage,node_askpage,node_api_client toneBlue
class node_backend,node_news_routes,node_article_routes,node_ai_routes,node_health_routes toneAmber
class node_news_service,node_news_repo,node_gemini_api toneMint
class node_article_service,node_article_repo,node_article_db toneRose
class node_chunk,node_embedding,node_vector,node_retrieval,node_gemini,node_pdf,node_reader,node_news_provider,node_pdf_file toneIndigo
```

## Components

### Reader interface

- [Web app](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/router.tsx): `frontend/src/router.tsx`
- [Discover feed](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/index.tsx): `frontend/src/routes/index.tsx`
- [News search](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/search.tsx): `frontend/src/routes/search.tsx`
- [Publisher browse](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/publisher.tsx): `frontend/src/routes/publisher.tsx`
- [Saved library](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/saved.tsx): `frontend/src/routes/saved.tsx`
- [Ask AI](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/routes/ask.tsx): `frontend/src/routes/ask.tsx`
- [API client](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Backend API

- [FastAPI app](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/main.py): `backend/main.py`
- [News routes](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/news.py): `backend/app/routers/news.py`
- [Article routes](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/articles.py): `backend/app/routers/articles.py`
- [AI routes](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/ai.py): `backend/app/routers/ai.py`
- [Health routes](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/routers/health.py): `backend/app/routers/health.py`

### News discovery

- [News normalization](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/news_service.py): `backend/app/services/news_service.py`
- [Provider access](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/repositories/news_repository.py): `backend/app/repositories/news_repository.py`

### Saved articles

- [Article operations](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/article_service.py): `backend/app/services/article_service.py`
- [Article persistence](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/repositories/article_repository.py): `backend/app/repositories/article_repository.py`
- [PostgreSQL](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/models/article.py): `backend/app/models/article.py`

### AI and exports

- [Text chunking](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/chunk_service.py): `backend/app/services/chunk_service.py`
- [Local embeddings](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`
- [FAISS index](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/vector_store.py): `backend/app/services/vector_store.py`
- [RAG retrieval](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`
- [Gemini generation](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/gemini_service.py): `backend/app/services/gemini_service.py`
- [PDF generation](https://github.com/ashwini1779/thedigest-ai--news-aggregator/blob/main/backend/app/services/pdf_service.py): `backend/app/services/pdf_service.py`

### Other components

- **Reader**
- **News providers**
- **Gemini API**
- **Generated PDF**

## Connections

- Reader → Web app: uses
- Web app → Discover feed: routes to
- Web app → News search: routes to
- Web app → Publisher browse: routes to
- Web app → Saved library: routes to
- Web app → Ask AI: routes to
- Discover feed → API client: requests headlines
- News search → API client: searches news
- Publisher browse → API client: requests publisher
- Saved library → API client: manages articles
- Ask AI → API client: submits questions
- API client → FastAPI app: REST JSON
- FastAPI app → News routes: dispatches
- FastAPI app → Article routes: dispatches
- FastAPI app → AI routes: dispatches
- FastAPI app → Health routes: dispatches
- News routes → News normalization: handles news
- News normalization → Provider access: fetches data
- Provider access → News providers: requests
- Article routes → Article operations: handles articles
- Article operations → Article persistence: persists articles
- Article persistence → PostgreSQL: reads and writes
- AI routes → Text chunking: indexes text
- Text chunking → Local embeddings: chunks embedded
- Local embeddings → FAISS index: adds vectors
- AI routes → RAG retrieval: retrieves context
- RAG retrieval → Local embeddings: embeds question
- RAG retrieval → FAISS index: searches vectors
- AI routes → Gemini generation: generates answers
- Gemini generation → Gemini API: calls
- Article routes → PDF generation: exports article
- PDF generation → Generated PDF: writes PDF
