# shayanhaider2005/ai-documentry-genrator architecture

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

- Interactive diagram: https://gitdiagram.com/shayanhaider2005/ai-documentry-genrator
- Repository: https://github.com/shayanhaider2005/ai-documentry-genrator

## Overview

DocuBot turns a lecture PDF into a narrated, scene-based documentary, through either the chat-style website or a headless pipeline. The main stages are PDF extraction and cleanup, script generation, visual selection, voice synthesis and timing, then Remotion preview or MP4 rendering. The website also supports document-grounded Q&A and optional voice cloning. README-described capabilities are included where source excerpts are incomplete; those limits are reflected by omitting uncertain wiring.

Main entry points: [`Documentry-ai-genrator/server/web.js`](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js) (HTTP API and jobs), [`Documentry-ai-genrator/server/pipeline.js`](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/pipeline.js) (Generation orchestration), [`Documentry-ai-genrator/web/src/App.tsx`](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/App.tsx) (Studio application), [`Documentry-ai-genrator/src/DocumentaryVideo.tsx`](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/DocumentaryVideo.tsx) (Remotion composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Web Studio"]
  node_webapp["Studio application<br/>[App.tsx]"]
  node_webui["Studio components<br/>[components.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_service["Web Service"]
  node_webserver["HTTP API and jobs<br/>[web.js]"]
  node_sessionstore[("Session state<br/>[web.js]")]
  node_chat["Document Q&amp;A<br/>[web.js]"]
end

subgraph group_generation["Documentary Generation"]
  node_pdf["PDF extraction<br/>[parsePdf.js]"]
  node_pipeline["Generation orchestration<br/>[pipeline.js]"]
  node_llm["LLM provider access<br/>[llm.js]"]
  node_visuals["Stock visual lookup<br/>[pipeline.js]"]
  node_tts["Voice synthesis<br/>[tts.js]"]
end

subgraph group_rendering["Video and Assets"]
  node_dataset["Scene dataset<br/>[dataset.json]"]
  node_audio["Narration audio"]
  node_timings["Word timing resolution<br/>[wordTimings.ts]"]
  node_composition["Remotion composition"]
  node_renderer["MP4 rendering<br/>[render.js]"]
  node_video["Rendered video"]
end

node_visitor(("Website user"))
node_cli(("CLI user"))
node_ai{{"LLM providers"}}
node_pexels{{"Pexels"}}
node_voice{{"ElevenLabs"}}

node_visitor -->|"uses"| node_webapp
node_webapp -->|"renders"| node_webui
node_webapp -->|"requests"| node_webapi
node_webapi -->|"calls API"| node_webserver
node_webserver -->|"reads/writes"| node_sessionstore
node_webserver -->|"parses upload"| node_pdf
node_webserver -->|"handles Q&amp;A"| node_chat
node_chat -->|"requests answer"| node_llm
node_llm -.->|"calls provider"| node_ai
node_webserver -->|"starts generation"| node_pipeline
node_cli -->|"runs pipeline"| node_pipeline
node_pipeline -->|"extracts text"| node_pdf
node_pipeline -->|"generates script"| node_llm
node_pipeline -->|"requests visuals"| node_visuals
node_visuals -.->|"searches images"| node_pexels
node_pipeline -->|"synthesizes scenes"| node_tts
node_tts -.->|"clones voice"| node_voice
node_pipeline -->|"writes narration"| node_audio
node_pipeline -->|"writes scenes"| node_dataset
node_webserver -->|"starts render"| node_renderer
node_renderer -->|"renders from"| node_dataset
node_renderer -->|"writes MP4"| node_video
node_webapp -->|"previews scenes"| node_composition
node_webui -->|"hosts player"| node_composition
node_composition -->|"resolves highlights"| node_timings
node_composition -->|"plays narration"| node_audio
node_webserver -->|"serves audio"| node_audio
node_webserver -->|"serves video"| node_video

click node_webapp "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/App.tsx"
click node_webui "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/components.tsx"
click node_webapi "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/api.ts"
click node_webserver "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js"
click node_sessionstore "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js"
click node_pdf "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/parsePdf.js"
click node_pipeline "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/pipeline.js"
click node_llm "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/llm.js"
click node_visuals "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/pipeline.js"
click node_tts "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/tts.js"
click node_dataset "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/dataset.json"
click node_audio "https://github.com/shayanhaider2005/ai-documentry-genrator/tree/main/Documentry-ai-genrator/public"
click node_timings "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/wordTimings.ts"
click node_composition "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/DocumentaryVideo.tsx"
click node_renderer "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/render.js"
click node_video "https://github.com/shayanhaider2005/ai-documentry-genrator/tree/main/Documentry-ai-genrator/server"
click node_chat "https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js"

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_webapp,node_webui,node_webapi,node_visitor,node_cli toneBlue
class node_webserver,node_sessionstore,node_chat toneAmber
class node_pdf,node_pipeline,node_llm,node_visuals,node_tts toneMint
class node_dataset,node_audio,node_timings,node_composition,node_renderer,node_video toneRose
class node_ai,node_pexels,node_voice toneIndigo
```

## Components

### Web Studio

- [Studio application](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/App.tsx): `Documentry-ai-genrator/web/src/App.tsx`
- [Studio components](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/components.tsx): `Documentry-ai-genrator/web/src/components.tsx`
- [API client](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/web/src/api.ts): `Documentry-ai-genrator/web/src/api.ts`

### Web Service

- [HTTP API and jobs](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js): `Documentry-ai-genrator/server/web.js`
- [Session state](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js): `Documentry-ai-genrator/server/web.js`
- [Document Q&A](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/web.js): `Documentry-ai-genrator/server/web.js`

### Documentary Generation

- [PDF extraction](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/parsePdf.js): `Documentry-ai-genrator/server/parsePdf.js`
- [Generation orchestration](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/pipeline.js): `Documentry-ai-genrator/server/pipeline.js`
- [LLM provider access](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/llm.js): `Documentry-ai-genrator/server/llm.js`
- [Stock visual lookup](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/pipeline.js): `Documentry-ai-genrator/server/pipeline.js`
- [Voice synthesis](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/tts.js): `Documentry-ai-genrator/server/tts.js`

### Video and Assets

- [Scene dataset](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/dataset.json): `Documentry-ai-genrator/src/dataset.json`
- [Narration audio](https://github.com/shayanhaider2005/ai-documentry-genrator/tree/main/Documentry-ai-genrator/public): `Documentry-ai-genrator/public`
- [Word timing resolution](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/wordTimings.ts): `Documentry-ai-genrator/src/wordTimings.ts`
- [Remotion composition](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/src/DocumentaryVideo.tsx): `Documentry-ai-genrator/src/DocumentaryVideo.tsx`
- [MP4 rendering](https://github.com/shayanhaider2005/ai-documentry-genrator/blob/main/Documentry-ai-genrator/server/render.js): `Documentry-ai-genrator/server/render.js`
- [Rendered video](https://github.com/shayanhaider2005/ai-documentry-genrator/tree/main/Documentry-ai-genrator/server): `Documentry-ai-genrator/server`

### Other components

- **Website user**
- **CLI user**
- **LLM providers**
- **Pexels**
- **ElevenLabs**

## Connections

- Website user → Studio application: uses
- Studio application → Studio components: renders
- Studio application → API client: requests
- API client → HTTP API and jobs: calls API
- HTTP API and jobs → Session state: reads/writes
- HTTP API and jobs → PDF extraction: parses upload
- HTTP API and jobs → Document Q&A: handles Q&A
- Document Q&A → LLM provider access: requests answer
- LLM provider access → LLM providers: calls provider
- HTTP API and jobs → Generation orchestration: starts generation
- CLI user → Generation orchestration: runs pipeline
- Generation orchestration → PDF extraction: extracts text
- Generation orchestration → LLM provider access: generates script
- Generation orchestration → Stock visual lookup: requests visuals
- Stock visual lookup → Pexels: searches images
- Generation orchestration → Voice synthesis: synthesizes scenes
- Voice synthesis → ElevenLabs: clones voice
- Generation orchestration → Narration audio: writes narration
- Generation orchestration → Scene dataset: writes scenes
- HTTP API and jobs → MP4 rendering: starts render
- MP4 rendering → Scene dataset: renders from
- MP4 rendering → Rendered video: writes MP4
- Studio application → Remotion composition: previews scenes
- Studio components → Remotion composition: hosts player
- Remotion composition → Word timing resolution: resolves highlights
- Remotion composition → Narration audio: plays narration
- HTTP API and jobs → Narration audio: serves audio
- HTTP API and jobs → Rendered video: serves video
