# unixx0/ai-blog-generator architecture

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

- Interactive diagram: https://gitdiagram.com/unixx0/ai-blog-generator
- Repository: https://github.com/unixx0/ai-blog-generator

## Overview

This is an interactive, LangGraph-based AI blog generator. A user supplies a topic; the workflow optionally researches it, plans sections, writes them in parallel, then assembles markdown and adds generated illustrations. It saves the markdown and offers a human decision point for PDF export. The graph combines README-documented stages with relationships visible in the sampled main.py excerpts; unsampled implementation details are not inferred.

Main entry points: [`main.py`](https://github.com/unixx0/ai-blog-generator/blob/main/main.py) (Section writers), [`logger.py`](https://github.com/unixx0/ai-blog-generator/blob/main/logger.py) (Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Blog workflow"]
  node_entry["Interactive workflow<br/>[main.py]"]
  node_router["Research router<br/>[main.py]"]
  node_search["Web search<br/>[main.py]"]
  node_logger["Logging<br/>[logger.py]"]
end

subgraph group_content["Content generation"]
  node_planner["Outline planner<br/>[main.py]"]
  node_fanout["Task fan-out<br/>[main.py]"]
  node_workers["Section writers<br/>[main.py]"]
  node_reducer["Result reducer<br/>[main.py]"]
end

subgraph group_illustration["Illustration and export"]
  node_concat["Markdown assembly<br/>[main.py]"]
  node_placeholders["Image planning<br/>[main.py]"]
  node_imagegen["Image generation<br/>[main.py]"]
  node_merge["Image embedding<br/>[main.py]"]
  node_markdown["Markdown file<br/>[main.py]"]
  node_approval["PDF decision<br/>[main.py]"]
  node_pdf["PDF export<br/>[main.py]"]
end

subgraph group_integrations["External integrations"]
  node_groq["Groq LLM"]
  node_huggingface["HuggingFace models"]
  node_tavily["Tavily search"]
  node_pandoc["Pandoc conversion"]
end

node_user(("Topic author"))

node_user -->|"provides topic"| node_entry
node_entry -->|"starts workflow"| node_router
node_router -.->|"routes optionally"| node_search
node_search -->|"queries"| node_tavily
node_router -->|"routes planning"| node_planner
node_search -.->|"supplies research"| node_planner
node_planner -->|"creates tasks"| node_fanout
node_fanout -->|"dispatches tasks"| node_workers
node_workers -->|"generates sections"| node_groq
node_workers -->|"generates sections"| node_huggingface
node_workers -->|"returns sections"| node_reducer
node_reducer -->|"invokes subgraph"| node_concat
node_concat -->|"passes markdown"| node_placeholders
node_placeholders -->|"provides image prompts"| node_imagegen
node_imagegen -->|"requests images"| node_huggingface
node_imagegen -->|"provides image paths"| node_merge
node_merge -->|"writes markdown"| node_markdown
node_merge -->|"requests decision"| node_approval
node_approval -->|"converts if approved"| node_pandoc
node_pandoc -->|"creates PDF"| node_pdf
node_entry -->|"configures logging"| node_logger

click node_entry "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_router "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_search "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_planner "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_fanout "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_workers "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_reducer "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_concat "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_placeholders "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_imagegen "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_merge "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_markdown "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_approval "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_pdf "https://github.com/unixx0/ai-blog-generator/blob/main/main.py"
click node_logger "https://github.com/unixx0/ai-blog-generator/blob/main/logger.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_entry,node_router,node_search,node_logger toneBlue
class node_planner,node_fanout,node_workers,node_reducer toneAmber
class node_concat,node_placeholders,node_imagegen,node_merge,node_markdown,node_approval,node_pdf toneMint
class node_groq,node_huggingface,node_tavily,node_pandoc toneRose
class node_user toneIndigo
```

## Components

### Blog workflow

- [Interactive workflow](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Research router](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Web search](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Logging](https://github.com/unixx0/ai-blog-generator/blob/main/logger.py): `logger.py`

### Content generation

- [Outline planner](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Task fan-out](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Section writers](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Result reducer](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`

### Illustration and export

- [Markdown assembly](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Image planning](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Image generation](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Image embedding](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [Markdown file](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [PDF decision](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`
- [PDF export](https://github.com/unixx0/ai-blog-generator/blob/main/main.py): `main.py`

### External integrations

- **Groq LLM**
- **HuggingFace models**
- **Tavily search**
- **Pandoc conversion**

### Other components

- **Topic author**

## Connections

- Topic author → Interactive workflow: provides topic (evidence: `README.md`)
- Interactive workflow → Research router: starts workflow (evidence: `README.md`)
- Research router → Web search: routes optionally (evidence: `README.md`)
- Web search → Tavily search: queries (evidence: `README.md`)
- Research router → Outline planner: routes planning (evidence: `README.md`)
- Web search → Outline planner: supplies research (evidence: `README.md`)
- Outline planner → Task fan-out: creates tasks (evidence: `main.py`)
- Task fan-out → Section writers: dispatches tasks (evidence: `main.py`)
- Section writers → Groq LLM: generates sections (evidence: `README.md`)
- Section writers → HuggingFace models: generates sections (evidence: `README.md`)
- Section writers → Result reducer: returns sections (evidence: `README.md`)
- Result reducer → Markdown assembly: invokes subgraph (evidence: `main.py`)
- Markdown assembly → Image planning: passes markdown (evidence: `main.py`)
- Image planning → Image generation: provides image prompts (evidence: `main.py`)
- Image generation → HuggingFace models: requests images (evidence: `main.py`)
- Image generation → Image embedding: provides image paths (evidence: `main.py`)
- Image embedding → Markdown file: writes markdown (evidence: `main.py`)
- Image embedding → PDF decision: requests decision (evidence: `main.py`)
- PDF decision → Pandoc conversion: converts if approved (evidence: `main.py`)
- Pandoc conversion → PDF export: creates PDF (evidence: `README.md`)
- Interactive workflow → Logging: configures logging (evidence: `main.py`)
