# zt6453928/news-agent architecture

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

- Interactive diagram: https://gitdiagram.com/zt6453928/news-agent
- Repository: https://github.com/zt6453928/news-agent

## Overview

News Agent Web collects RSS stories, turns them into AI-generated daily articles, and exposes them through a configurable web application. The main workflow runs through the backend collection service, which coordinates feed collection and article generation before persisting results; it can be started manually or on a schedule. The frontend provides article browsing and feed, category, API, and schedule management. Relationships for sampled backend calls are supported by source references or excerpts; frontend-to-API links and unsampled capabilities are based on the README, so implementation detail there is limited.

Main entry points: [`backend/app/news_service.py`](https://github.com/zt6453928/news-agent/blob/main/backend/app/news_service.py) (News service), [`backend/app/main.py`](https://github.com/zt6453928/news-agent/blob/main/backend/app/main.py) (HTTP API routes), [`frontend/src/lib/api.ts`](https://github.com/zt6453928/news-agent/blob/main/frontend/src/lib/api.ts) (API client), [`backend/app/generator.py`](https://github.com/zt6453928/news-agent/blob/main/backend/app/generator.py) (Article generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_home["Article home<br/>[page.tsx]"]
  node_article_list["Article list<br/>[article-list.tsx]"]
  node_article_detail["Article detail<br/>[page.tsx]"]
  node_settings_ui["Settings UI<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_layout["App shell<br/>[layout.tsx]"]
end

subgraph group_api["API and services"]
  node_api_routes["HTTP API routes<br/>[main.py]"]
  node_schemas["API and domain schemas<br/>[schemas.py]"]
end

subgraph group_content["News production"]
  node_news_service["News service<br/>[news_service.py]"]
  node_collector["RSS collector<br/>[collector.py]"]
  node_generator["Article generator<br/>[generator.py]"]
end

subgraph group_state["Persistence and settings"]
  node_data_models["Data models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[models.py]")]
  node_settings_service["Settings service"]
end

subgraph group_automation["Scheduling"]
  node_scheduler["Daily scheduler<br/>[scheduler.py]"]
end

node_reader(("Reader / admin"))
node_rss_sources(("RSS providers"))
node_ai_provider(("OpenAI-compatible API"))

node_reader -->|"browses"| node_home
node_reader -->|"configures"| node_settings_ui
node_home -.->|"requests articles"| node_api_client
node_article_detail -.->|"requests article"| node_api_client
node_settings_ui -->|"manages settings"| node_api_client
node_layout -.->|"renders page"| node_home
node_api_client -->|"calls API"| node_api_routes
node_api_routes -->|"delegates news"| node_news_service
node_api_routes -->|"delegates settings"| node_settings_service
node_api_routes -->|"updates schedule"| node_scheduler
node_news_service -->|"collects feeds"| node_collector
node_news_service -->|"generates articles"| node_generator
node_collector -->|"fetches RSS"| node_rss_sources
node_generator -->|"requests generation"| node_ai_provider
node_news_service -->|"reads and writes"| node_data_models
node_settings_service -->|"reads and writes"| node_data_models
node_data_models -->|"persists records"| node_sqlite
node_news_service -->|"uses domain types"| node_schemas
node_generator -->|"uses article types"| node_schemas
node_scheduler -->|"runs collection"| node_news_service
node_scheduler -->|"reads schedule"| node_settings_service

click node_home "https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/page.tsx"
click node_article_list "https://github.com/zt6453928/news-agent/blob/main/frontend/src/components/article-list.tsx"
click node_article_detail "https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/article/%5Bslug%5D/page.tsx"
click node_settings_ui "https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/settings/page.tsx"
click node_api_client "https://github.com/zt6453928/news-agent/blob/main/frontend/src/lib/api.ts"
click node_layout "https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/layout.tsx"
click node_api_routes "https://github.com/zt6453928/news-agent/blob/main/backend/app/main.py"
click node_news_service "https://github.com/zt6453928/news-agent/blob/main/backend/app/news_service.py"
click node_collector "https://github.com/zt6453928/news-agent/blob/main/backend/app/collector.py"
click node_generator "https://github.com/zt6453928/news-agent/blob/main/backend/app/generator.py"
click node_data_models "https://github.com/zt6453928/news-agent/blob/main/backend/app/models.py"
click node_sqlite "https://github.com/zt6453928/news-agent/blob/main/backend/app/models.py"
click node_settings_service "https://github.com/zt6453928/news-agent/blob/main/backend/app/settings_service.py"
click node_schemas "https://github.com/zt6453928/news-agent/blob/main/backend/app/schemas.py"
click node_scheduler "https://github.com/zt6453928/news-agent/blob/main/backend/app/scheduler.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_home,node_article_list,node_article_detail,node_settings_ui,node_api_client,node_layout toneBlue
class node_api_routes,node_schemas toneAmber
class node_news_service,node_collector,node_generator,node_ai_provider toneMint
class node_data_models,node_sqlite,node_settings_service toneRose
class node_scheduler,node_reader,node_rss_sources toneIndigo
```

## Components

### Web application

- [Article home](https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Article list](https://github.com/zt6453928/news-agent/blob/main/frontend/src/components/article-list.tsx): `frontend/src/components/article-list.tsx`
- [Article detail](https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/article/%5Bslug%5D/page.tsx): `frontend/src/app/article/[slug]/page.tsx`
- [Settings UI](https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/settings/page.tsx): `frontend/src/app/settings/page.tsx`
- [API client](https://github.com/zt6453928/news-agent/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [App shell](https://github.com/zt6453928/news-agent/blob/main/frontend/src/app/layout.tsx): `frontend/src/app/layout.tsx`

### API and services

- [HTTP API routes](https://github.com/zt6453928/news-agent/blob/main/backend/app/main.py): `backend/app/main.py`
- [API and domain schemas](https://github.com/zt6453928/news-agent/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### News production

- [News service](https://github.com/zt6453928/news-agent/blob/main/backend/app/news_service.py): `backend/app/news_service.py`
- [RSS collector](https://github.com/zt6453928/news-agent/blob/main/backend/app/collector.py): `backend/app/collector.py`
- [Article generator](https://github.com/zt6453928/news-agent/blob/main/backend/app/generator.py): `backend/app/generator.py`

### Persistence and settings

- [Data models](https://github.com/zt6453928/news-agent/blob/main/backend/app/models.py): `backend/app/models.py`
- [SQLite database](https://github.com/zt6453928/news-agent/blob/main/backend/app/models.py): `backend/app/models.py`
- [Settings service](https://github.com/zt6453928/news-agent/blob/main/backend/app/settings_service.py): `backend/app/settings_service.py`

### Scheduling

- [Daily scheduler](https://github.com/zt6453928/news-agent/blob/main/backend/app/scheduler.py): `backend/app/scheduler.py`

### Other components

- **Reader / admin**
- **RSS providers**
- **OpenAI-compatible API**

## Connections

- Reader / admin → Article home: browses (evidence: `README.md`)
- Reader / admin → Settings UI: configures (evidence: `README.md`)
- Article home → API client: requests articles
- Article detail → API client: requests article
- Settings UI → API client: manages settings (evidence: `frontend/src/app/settings/page.tsx`)
- App shell → Article home: renders page
- API client → HTTP API routes: calls API (evidence: `README.md`)
- HTTP API routes → News service: delegates news (evidence: `backend/app/main.py`)
- HTTP API routes → Settings service: delegates settings (evidence: `backend/app/main.py`)
- HTTP API routes → Daily scheduler: updates schedule (evidence: `backend/app/main.py`)
- News service → RSS collector: collects feeds (evidence: `backend/app/news_service.py`)
- News service → Article generator: generates articles (evidence: `backend/app/news_service.py`)
- RSS collector → RSS providers: fetches RSS (evidence: `backend/app/collector.py`)
- Article generator → OpenAI-compatible API: requests generation (evidence: `backend/app/generator.py`)
- News service → Data models: reads and writes (evidence: `backend/app/news_service.py`)
- Settings service → Data models: reads and writes (evidence: `backend/app/settings_service.py`)
- Data models → SQLite database: persists records (evidence: `backend/app/models.py`)
- News service → API and domain schemas: uses domain types (evidence: `backend/app/news_service.py`)
- Article generator → API and domain schemas: uses article types (evidence: `backend/app/generator.py`)
- Daily scheduler → News service: runs collection (evidence: `backend/app/scheduler.py`)
- Daily scheduler → Settings service: reads schedule (evidence: `backend/app/scheduler.py`)
