# hamzaamir1470/personal-ai-journalist architecture

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

- Interactive diagram: https://gitdiagram.com/hamzaamir1470/personal-ai-journalist
- Repository: https://github.com/hamzaamir1470/personal-ai-journalist

## Overview

Personal AI Journalist turns user-selected topics and source preferences into downloadable audio summaries. The Streamlit interface posts requests to a FastAPI endpoint, which conditionally runs news scraping and Reddit analysis, then generates a broadcast script and ElevenLabs audio for the frontend. The news path extracts headlines before summarization; the Reddit path uses an MCP-backed agent. README documentation is absent, so the map follows the sampled source; unsampled subsystems are not inferred.

Main entry points: [`backend.py`](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/backend.py) (Audio Endpoint), [`reddit_scrapper.py`](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/reddit_scrapper.py) (Reddit Analysis), [`frontend.py`](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/frontend.py) (Topic Interface), [`news_scrapper.py`](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/news_scrapper.py) (News Scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_frontend["Topic Interface<br/>[frontend.py]"]
end

subgraph group_orchestration["Request Orchestration"]
  node_request["News Request<br/>[models.py]"]
  node_backend["Audio Endpoint<br/>[backend.py]"]
end

subgraph group_sources["Source Analysis"]
  node_news["News Scraper<br/>[news_scrapper.py]"]
  node_news_utils["News Extraction<br/>[utils.py]"]
  node_reddit["Reddit Analysis<br/>[reddit_scrapper.py]"]
end

subgraph group_production["Broadcast Production"]
  node_script["Broadcast Script<br/>[utils.py]"]
  node_speech["Audio Synthesis<br/>[utils.py]"]
end

node_user(("Topic User"))
node_mcp["ScraperAPI MCP"]
node_mistral["Mistral AI"]
node_elevenlabs["ElevenLabs"]

node_user -->|"selects topics"| node_frontend
node_frontend -->|"posts request"| node_backend
node_backend -->|"validates as"| node_request
node_backend -->|"scrapes news"| node_news
node_backend -->|"scrapes Reddit"| node_reddit
node_news -->|"extracts and summarizes"| node_news_utils
node_news_utils -->|"summarizes headlines"| node_mistral
node_reddit -->|"loads tools"| node_mcp
node_reddit -->|"runs agent"| node_mistral
node_backend -->|"generates script"| node_script
node_backend -->|"converts script"| node_speech
node_speech -->|"requests speech"| node_elevenlabs
node_backend -->|"returns audio"| node_frontend

click node_frontend "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/frontend.py"
click node_request "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/models.py"
click node_backend "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/backend.py"
click node_news "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/news_scrapper.py"
click node_news_utils "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.py"
click node_reddit "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/reddit_scrapper.py"
click node_script "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.py"
click node_speech "https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.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_user toneBlue
class node_request,node_backend toneAmber
class node_news,node_news_utils,node_reddit,node_mcp toneMint
class node_script,node_speech toneRose
class node_mistral,node_elevenlabs toneIndigo
```

## Components

### User Interface

- [Topic Interface](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/frontend.py): `frontend.py`

### Request Orchestration

- [News Request](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/models.py): `models.py`
- [Audio Endpoint](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/backend.py): `backend.py`

### Source Analysis

- [News Scraper](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/news_scrapper.py): `news_scrapper.py`
- [News Extraction](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.py): `utils.py`
- [Reddit Analysis](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/reddit_scrapper.py): `reddit_scrapper.py`

### Broadcast Production

- [Broadcast Script](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.py): `utils.py`
- [Audio Synthesis](https://github.com/hamzaamir1470/personal-ai-journalist/blob/main/utils.py): `utils.py`

### Other components

- **Topic User**
- **ScraperAPI MCP**
- **Mistral AI**
- **ElevenLabs**

## Connections

- Topic User → Topic Interface: selects topics (evidence: `frontend.py`)
- Topic Interface → Audio Endpoint: posts request (evidence: `frontend.py`)
- Audio Endpoint → News Request: validates as (evidence: `backend.py`)
- Audio Endpoint → News Scraper: scrapes news (evidence: `backend.py`)
- Audio Endpoint → Reddit Analysis: scrapes Reddit (evidence: `backend.py`)
- News Scraper → News Extraction: extracts and summarizes (evidence: `news_scrapper.py`)
- News Extraction → Mistral AI: summarizes headlines (evidence: `utils.py`)
- Reddit Analysis → ScraperAPI MCP: loads tools (evidence: `reddit_scrapper.py`)
- Reddit Analysis → Mistral AI: runs agent (evidence: `reddit_scrapper.py`)
- Audio Endpoint → Broadcast Script: generates script (evidence: `backend.py`)
- Audio Endpoint → Audio Synthesis: converts script (evidence: `backend.py`)
- Audio Synthesis → ElevenLabs: requests speech (evidence: `utils.py`)
- Audio Endpoint → Topic Interface: returns audio (evidence: `backend.py`)
