# lazypandaa/napkin architecture

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

- Interactive diagram: https://gitdiagram.com/lazypandaa/napkin
- Repository: https://github.com/lazypandaa/napkin

## Overview

Auto-PPT Agent turns a topic and requirements into a planned presentation, previews it in a React editor, and exports a themed .pptx. The web flow runs through FastAPI; the documented CLI is a second entry point to planning and dual-MCP rendering. Main owns the documented tool-call sequence; frontend rendering and image proxy use are visible in excerpts. The CLI-to-rendering and unsampled renderer details are documented in the README, not independently verified in source.

Main entry points: [`backend/main.py`](https://github.com/lazypandaa/napkin/blob/main/backend/main.py) (FastAPI bridge), [`frontend/src/App.jsx`](https://github.com/lazypandaa/napkin/blob/main/frontend/src/App.jsx) (App workflow), [`backend/agent.py`](https://github.com/lazypandaa/napkin/blob/main/backend/agent.py) (CLI agent), [`backend/generator.py`](https://github.com/lazypandaa/napkin/blob/main/backend/generator.py) (LLM planner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_home["Home and history<br/>[HomePage.jsx]"]
  node_modal["Prompt form<br/>[GenerateModal.jsx]"]
  node_app["App workflow<br/>[App.jsx]"]
  node_sidebar["Slide navigation<br/>[Sidebar.jsx]"]
  node_canvas["Slide preview<br/>[SlideCanvas.jsx]"]
  node_card["Slide layouts<br/>[SlideCard.jsx]"]
  node_present["Presentation mode<br/>[PresentMode.jsx]"]
  node_topbar["Export controls<br/>[Topbar.jsx]"]
end

subgraph group_api["Backend bridge"]
  node_api["FastAPI bridge<br/>[main.py]"]
  node_history[("Plan history<br/>[main.py]")]
  node_imageproxy["Image proxy<br/>[main.py]"]
end

subgraph group_planning["Planning"]
  node_generator["LLM planner<br/>[generator.py]"]
  node_agent["CLI agent<br/>[agent.py]"]
end

subgraph group_mcp["MCP services"]
  node_render["PPT rendering tools<br/>[mcp_server.py]"]
  node_search["Image search tool<br/>[web_search_mcp.py]"]
end

node_user(("User"))
node_cli(("CLI user"))
node_llm{{"Hugging Face model"}}
node_pexels{{"Pexels API"}}
node_pptx["PPTX file"]

node_user -->|"opens"| node_home
node_home -->|"starts creation"| node_modal
node_modal -->|"submits prompt"| node_app
node_app -->|"POST /generate"| node_api
node_api -->|"plans slides"| node_generator
node_generator -->|"requests outline"| node_llm
node_generator -->|"returns plan"| node_api
node_api -->|"stores plan"| node_history
node_home -->|"GET /history"| node_api
node_api -->|"reads plans"| node_history
node_api -->|"returns plan"| node_app
node_app -->|"shows slides"| node_sidebar
node_app -->|"shows preview"| node_canvas
node_canvas -->|"renders slides"| node_card
node_sidebar -->|"requests images"| node_imageproxy
node_card -->|"requests images"| node_imageproxy
node_app -->|"shows controls"| node_topbar
node_topbar -->|"requests export"| node_app
node_app -->|"opens mode"| node_present
node_present -->|"renders slides"| node_card
node_imageproxy -->|"searches and fetches"| node_pexels
node_user -.->|"requests export"| node_api
node_api -->|"calls search_image"| node_search
node_api -->|"calls render tools"| node_render
node_search -.->|"searches images"| node_pexels
node_render -.->|"saves presentation"| node_pptx
node_cli -->|"runs prompt"| node_agent
node_agent -->|"plans presentation"| node_generator
node_agent -.->|"uses MCP tools"| node_search
node_agent -.->|"uses MCP tools"| node_render

click node_home "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/HomePage.jsx"
click node_modal "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/GenerateModal.jsx"
click node_app "https://github.com/lazypandaa/napkin/blob/main/frontend/src/App.jsx"
click node_sidebar "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/Sidebar.jsx"
click node_canvas "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/SlideCanvas.jsx"
click node_card "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/SlideCard.jsx"
click node_present "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/PresentMode.jsx"
click node_topbar "https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/Topbar.jsx"
click node_api "https://github.com/lazypandaa/napkin/blob/main/backend/main.py"
click node_history "https://github.com/lazypandaa/napkin/blob/main/backend/main.py"
click node_imageproxy "https://github.com/lazypandaa/napkin/blob/main/backend/main.py"
click node_generator "https://github.com/lazypandaa/napkin/blob/main/backend/generator.py"
click node_agent "https://github.com/lazypandaa/napkin/blob/main/backend/agent.py"
click node_render "https://github.com/lazypandaa/napkin/blob/main/backend/mcp_server.py"
click node_search "https://github.com/lazypandaa/napkin/blob/main/backend/web_search_mcp.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_modal,node_app,node_sidebar,node_canvas,node_card,node_present,node_topbar,node_user,node_cli toneBlue
class node_api,node_history,node_imageproxy toneAmber
class node_generator,node_agent,node_pexels toneMint
class node_render,node_search toneRose
class node_llm,node_pptx toneIndigo
```

## Components

### Web interface

- [Home and history](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/HomePage.jsx): `frontend/src/components/HomePage.jsx`
- [Prompt form](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/GenerateModal.jsx): `frontend/src/components/GenerateModal.jsx`
- [App workflow](https://github.com/lazypandaa/napkin/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Slide navigation](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Slide preview](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/SlideCanvas.jsx): `frontend/src/components/SlideCanvas.jsx`
- [Slide layouts](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/SlideCard.jsx): `frontend/src/components/SlideCard.jsx`
- [Presentation mode](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/PresentMode.jsx): `frontend/src/components/PresentMode.jsx`
- [Export controls](https://github.com/lazypandaa/napkin/blob/main/frontend/src/components/Topbar.jsx): `frontend/src/components/Topbar.jsx`

### Backend bridge

- [FastAPI bridge](https://github.com/lazypandaa/napkin/blob/main/backend/main.py): `backend/main.py`
- [Plan history](https://github.com/lazypandaa/napkin/blob/main/backend/main.py): `backend/main.py`
- [Image proxy](https://github.com/lazypandaa/napkin/blob/main/backend/main.py): `backend/main.py`

### Planning

- [LLM planner](https://github.com/lazypandaa/napkin/blob/main/backend/generator.py): `backend/generator.py`
- [CLI agent](https://github.com/lazypandaa/napkin/blob/main/backend/agent.py): `backend/agent.py`

### MCP services

- [PPT rendering tools](https://github.com/lazypandaa/napkin/blob/main/backend/mcp_server.py): `backend/mcp_server.py`
- [Image search tool](https://github.com/lazypandaa/napkin/blob/main/backend/web_search_mcp.py): `backend/web_search_mcp.py`

### Other components

- **User**
- **CLI user**
- **Hugging Face model**
- **Pexels API**
- **PPTX file**

## Connections

- User → Home and history: opens (evidence: `README.md`)
- Home and history → Prompt form: starts creation (evidence: `frontend/src/components/HomePage.jsx`)
- Prompt form → App workflow: submits prompt (evidence: `frontend/src/components/GenerateModal.jsx`)
- App workflow → FastAPI bridge: POST /generate (evidence: `frontend/src/App.jsx`)
- FastAPI bridge → LLM planner: plans slides (evidence: `backend/main.py`)
- LLM planner → Hugging Face model: requests outline (evidence: `backend/generator.py`)
- LLM planner → FastAPI bridge: returns plan (evidence: `backend/main.py`)
- FastAPI bridge → Plan history: stores plan (evidence: `backend/main.py`)
- Home and history → FastAPI bridge: GET /history (evidence: `frontend/src/components/HomePage.jsx`)
- FastAPI bridge → Plan history: reads plans (evidence: `backend/main.py`)
- FastAPI bridge → App workflow: returns plan (evidence: `backend/main.py`)
- App workflow → Slide navigation: shows slides (evidence: `frontend/src/App.jsx`)
- App workflow → Slide preview: shows preview (evidence: `frontend/src/App.jsx`)
- Slide preview → Slide layouts: renders slides (evidence: `frontend/src/components/SlideCanvas.jsx`)
- Slide navigation → Image proxy: requests images (evidence: `frontend/src/components/Sidebar.jsx`)
- Slide layouts → Image proxy: requests images (evidence: `frontend/src/components/SlideCard.jsx`)
- App workflow → Export controls: shows controls (evidence: `frontend/src/App.jsx`)
- Export controls → App workflow: requests export (evidence: `frontend/src/components/Topbar.jsx`)
- App workflow → Presentation mode: opens mode (evidence: `frontend/src/App.jsx`)
- Presentation mode → Slide layouts: renders slides (evidence: `frontend/src/components/PresentMode.jsx`)
- Image proxy → Pexels API: searches and fetches (evidence: `backend/main.py`)
- User → FastAPI bridge: requests export (evidence: `README.md`)
- FastAPI bridge → Image search tool: calls search_image (evidence: `backend/main.py`)
- FastAPI bridge → PPT rendering tools: calls render tools (evidence: `backend/main.py`)
- Image search tool → Pexels API: searches images (evidence: `README.md`)
- PPT rendering tools → PPTX file: saves presentation (evidence: `README.md`)
- CLI user → CLI agent: runs prompt (evidence: `README.md`)
- CLI agent → LLM planner: plans presentation (evidence: `backend/agent.py`)
- CLI agent → Image search tool: uses MCP tools (evidence: `README.md`)
- CLI agent → PPT rendering tools: uses MCP tools (evidence: `README.md`)
