# wildstar1965/rayflowai architecture

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

- Interactive diagram: https://gitdiagram.com/wildstar1965/rayflowai
- Repository: https://github.com/wildstar1965/rayflowai

## Overview

RayFlow AI is a browser-based studio for turning photos, soundtrack audio, and voice or text directions into vertical cinematic reels. The workflow runs from media upload and beat analysis through timeline planning and interactive editing to asynchronous FFmpeg rendering and export. The README also describes local project persistence, preview playback, captions, visual inserts, and creative editing features. Edges reflect the README, shown excerpts, and SOURCE INDEX references; several service internals were not sampled, so their detailed call paths are not asserted.

Main entry points: [`backend/app/api/routes.py`](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/routes.py) (FastAPI Routes), [`frontend/src/pages/StudioPage.tsx`](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/pages/StudioPage.tsx) (Studio Workspace), [`frontend/src/services/api.ts`](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/services/api.ts) (REST Client), [`backend/app/api/creative_routes.py`](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/creative_routes.py) (Creative Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Editing Studio"]
  node_studio_page["Studio Workspace<br/>[StudioPage.tsx]"]
  node_studio_timeline["Interactive Timeline"]
  node_creative_panel["Creative Controls<br/>[CreativePanel.tsx]"]
  node_preview["Live Preview"]
  node_local_projects[("Local Projects<br/>[StudioPage.tsx]")]
  node_api_client["REST Client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_backend_api["FastAPI Routes<br/>[routes.py]"]
  node_creative_api["Creative Routes<br/>[creative_routes.py]"]
  node_contracts["Editing Plan Schema<br/>[editing_plan.py]"]
end

subgraph group_planning["Planning and Creative Services"]
  node_audio_analysis["Beat Analysis<br/>[audio_analysis.py]"]
  node_command_interpreter["Directive Interpreter"]
  node_timeline_builder["Timeline Builder"]
  node_auto_edit["Auto Reel Editing<br/>[auto_edit.py]"]
  node_broll["B-Roll Selection<br/>[broll.py]"]
  node_transcription["Speech Transcription"]
end

subgraph group_rendering["Rendering and Media"]
  node_media_service["Media Uploads<br/>[media.py]"]
  node_renderer["FFmpeg Renderer<br/>[video_renderer.py]"]
  node_media_storage[("Media Storage<br/>[config.py]")]
end

node_creator(("Creator"))
node_ollama["Local Ollama"]
node_pixabay["Pixabay Provider"]
node_export["Rendered Reel"]

node_creator -->|"edits in"| node_studio_page
node_studio_page -->|"requests media and edits"| node_api_client
node_studio_page -->|"uses timeline"| node_studio_timeline
node_studio_page -->|"uses controls"| node_creative_panel
node_studio_page -->|"uses preview"| node_preview
node_studio_page -->|"persists locally"| node_local_projects
node_studio_timeline -->|"loads media URLs"| node_api_client
node_preview -->|"loads media"| node_api_client
node_api_client -->|"calls REST endpoints"| node_backend_api
node_api_client -->|"calls creative endpoints"| node_creative_api
node_backend_api -->|"handles uploads"| node_media_service
node_backend_api -->|"analyzes soundtrack"| node_audio_analysis
node_backend_api -->|"interprets directives"| node_command_interpreter
node_backend_api -->|"builds project plan"| node_timeline_builder
node_backend_api -->|"starts auto edit"| node_auto_edit
node_backend_api -->|"uses transcription"| node_transcription
node_backend_api -->|"starts render job"| node_renderer
node_backend_api -->|"validates plans"| node_contracts
node_creative_api -->|"selects assets"| node_broll
node_creative_api -.->|"downloads assets"| node_pixabay
node_command_interpreter -.->|"optional interpretation"| node_ollama
node_renderer -->|"reads and writes media"| node_media_storage
node_renderer -->|"produces MP4"| node_export

click node_studio_page "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/pages/StudioPage.tsx"
click node_studio_timeline "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/InteractiveTimeline.tsx"
click node_creative_panel "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/CreativePanel.tsx"
click node_preview "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/useCreativePreview.ts"
click node_local_projects "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/pages/StudioPage.tsx"
click node_api_client "https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/services/api.ts"
click node_backend_api "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/routes.py"
click node_creative_api "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/creative_routes.py"
click node_contracts "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/schemas/editing_plan.py"
click node_media_service "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/media.py"
click node_audio_analysis "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/audio_analysis.py"
click node_command_interpreter "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/command_interpreter.py"
click node_timeline_builder "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/timeline_builder.py"
click node_auto_edit "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/auto_edit.py"
click node_broll "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/broll.py"
click node_transcription "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/speech_transcription.py"
click node_renderer "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/video_renderer.py"
click node_media_storage "https://github.com/wildstar1965/rayflowai/blob/master/backend/app/core/config.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_studio_page,node_studio_timeline,node_creative_panel,node_preview,node_local_projects,node_api_client toneBlue
class node_backend_api,node_creative_api,node_contracts toneAmber
class node_audio_analysis,node_command_interpreter,node_timeline_builder,node_auto_edit,node_broll,node_transcription toneMint
class node_media_service,node_renderer,node_media_storage toneRose
class node_creator,node_ollama,node_pixabay,node_export toneIndigo
```

## Components

### Editing Studio

- [Studio Workspace](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/pages/StudioPage.tsx): `frontend/src/pages/StudioPage.tsx`
- [Interactive Timeline](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/InteractiveTimeline.tsx): `frontend/src/components/studio/InteractiveTimeline.tsx`
- [Creative Controls](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/CreativePanel.tsx): `frontend/src/components/studio/CreativePanel.tsx`
- [Live Preview](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/components/studio/useCreativePreview.ts): `frontend/src/components/studio/useCreativePreview.ts`
- [Local Projects](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/pages/StudioPage.tsx): `frontend/src/pages/StudioPage.tsx`
- [REST Client](https://github.com/wildstar1965/rayflowai/blob/master/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [FastAPI Routes](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/routes.py): `backend/app/api/routes.py`
- [Creative Routes](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/api/creative_routes.py): `backend/app/api/creative_routes.py`
- [Editing Plan Schema](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/schemas/editing_plan.py): `backend/app/schemas/editing_plan.py`

### Planning and Creative Services

- [Beat Analysis](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/audio_analysis.py): `backend/app/services/audio_analysis.py`
- [Directive Interpreter](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/command_interpreter.py): `backend/app/services/command_interpreter.py`
- [Timeline Builder](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/timeline_builder.py): `backend/app/services/timeline_builder.py`
- [Auto Reel Editing](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/auto_edit.py): `backend/app/services/auto_edit.py`
- [B-Roll Selection](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/broll.py): `backend/app/services/broll.py`
- [Speech Transcription](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/speech_transcription.py): `backend/app/services/speech_transcription.py`

### Rendering and Media

- [Media Uploads](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/media.py): `backend/app/services/media.py`
- [FFmpeg Renderer](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/services/video_renderer.py): `backend/app/services/video_renderer.py`
- [Media Storage](https://github.com/wildstar1965/rayflowai/blob/master/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Creator**
- **Local Ollama**
- **Pixabay Provider**
- **Rendered Reel**

## Connections

- Creator → Studio Workspace: edits in (evidence: `README.md`)
- Studio Workspace → REST Client: requests media and edits (evidence: `frontend/src/pages/StudioPage.tsx`)
- Studio Workspace → Interactive Timeline: uses timeline (evidence: `frontend/src/pages/StudioPage.tsx`)
- Studio Workspace → Creative Controls: uses controls (evidence: `frontend/src/pages/StudioPage.tsx`)
- Studio Workspace → Live Preview: uses preview (evidence: `frontend/src/pages/StudioPage.tsx`)
- Studio Workspace → Local Projects: persists locally (evidence: `README.md`)
- Interactive Timeline → REST Client: loads media URLs (evidence: `frontend/src/components/studio/InteractiveTimeline.tsx`)
- Live Preview → REST Client: loads media (evidence: `frontend/src/components/studio/useCreativePreview.ts`)
- REST Client → FastAPI Routes: calls REST endpoints (evidence: `frontend/src/services/api.ts`)
- REST Client → Creative Routes: calls creative endpoints (evidence: `frontend/src/services/api.ts`)
- FastAPI Routes → Media Uploads: handles uploads (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Beat Analysis: analyzes soundtrack (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Directive Interpreter: interprets directives (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Timeline Builder: builds project plan (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Auto Reel Editing: starts auto edit (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → Speech Transcription: uses transcription (evidence: `backend/app/api/routes.py`)
- FastAPI Routes → FFmpeg Renderer: starts render job (evidence: `README.md`)
- FastAPI Routes → Editing Plan Schema: validates plans (evidence: `backend/app/api/routes.py`)
- Creative Routes → B-Roll Selection: selects assets (evidence: `backend/app/api/creative_routes.py`)
- Creative Routes → Pixabay Provider: downloads assets (evidence: `backend/app/api/creative_routes.py`)
- Directive Interpreter → Local Ollama: optional interpretation (evidence: `backend/app/services/command_interpreter.py`)
- FFmpeg Renderer → Media Storage: reads and writes media (evidence: `backend/app/services/video_renderer.py`)
- FFmpeg Renderer → Rendered Reel: produces MP4 (evidence: `README.md`)
