# samgit06/flowautomation architecture

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

- Interactive diagram: https://gitdiagram.com/samgit06/flowautomation
- Repository: https://github.com/samgit06/flowautomation

## Overview

FlowAutomation is a Flask-backed tool for automating video generation in Google Flow. The apparent workflow is that a user supplies videos through the web UI, the server starts a background run, and Playwright drives Flow to generate each video with retries. The server also maintains analytics and streams logs and typed events. The supplied source excerpt shows server-side behavior but not the HTML or all route and worker code, so UI connections and unshown wiring are marked unverified or omitted.

Main entry points: [`server.py`](https://github.com/samgit06/flowautomation/blob/main/server.py) (Flask API), [`flow_automation_ui.html`](https://github.com/samgit06/flowautomation/blob/main/flow_automation_ui.html) (Automation UI), [`analytics.html`](https://github.com/samgit06/flowautomation/blob/main/analytics.html) (Analytics view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_ui["Automation UI"]
  node_analytics_ui["Analytics view<br/>[analytics.html]"]
end

subgraph group_runtime["Automation runtime"]
  node_api["Flask API<br/>[server.py]"]
  node_worker["Run worker<br/>[server.py]"]
  node_video_generation["Video generation<br/>[server.py]"]
  node_state["Run state<br/>[server.py]"]
end

subgraph group_observability["Run tracking"]
  node_analytics_store[("Analytics file<br/>[server.py]")]
  node_log_buffer["Log buffer<br/>[server.py]"]
  node_event_broadcast["Event broadcast<br/>[server.py]"]
  node_sse["SSE stream<br/>[server.py]"]
end

node_user(("User"))
node_flow["Google Flow"]

node_user -.->|"configures runs"| node_ui
node_ui -.->|"submits videos"| node_api
node_api -->|"starts thread"| node_worker
node_worker -->|"calls per video"| node_video_generation
node_video_generation -.->|"drives browser"| node_flow
node_worker -.->|"updates status"| node_state
node_worker -.->|"updates analytics"| node_analytics_store
node_analytics_ui -.->|"views metrics"| node_analytics_store
node_api -->|"reads logs"| node_log_buffer
node_api -->|"opens stream"| node_sse
node_event_broadcast -->|"queues events"| node_sse
node_sse -.->|"streams updates"| node_ui

click node_ui "https://github.com/samgit06/flowautomation/blob/main/flow_automation_ui.html"
click node_analytics_ui "https://github.com/samgit06/flowautomation/blob/main/analytics.html"
click node_api "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_worker "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_video_generation "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_state "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_analytics_store "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_log_buffer "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_event_broadcast "https://github.com/samgit06/flowautomation/blob/main/server.py"
click node_sse "https://github.com/samgit06/flowautomation/blob/main/server.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_ui,node_analytics_ui,node_user toneBlue
class node_api,node_worker,node_video_generation,node_state toneAmber
class node_analytics_store,node_log_buffer,node_event_broadcast,node_sse toneMint
class node_flow toneIndigo
```

## Components

### Web interface

- [Automation UI](https://github.com/samgit06/flowautomation/blob/main/flow_automation_ui.html): `flow_automation_ui.html`
- [Analytics view](https://github.com/samgit06/flowautomation/blob/main/analytics.html): `analytics.html`

### Automation runtime

- [Flask API](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [Run worker](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [Video generation](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [Run state](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`

### Run tracking

- [Analytics file](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [Log buffer](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [Event broadcast](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`
- [SSE stream](https://github.com/samgit06/flowautomation/blob/main/server.py): `server.py`

### Other components

- **User**
- **Google Flow**

## Connections

- User → Automation UI: configures runs
- Automation UI → Flask API: submits videos
- Flask API → Run worker: starts thread (evidence: `server.py`)
- Run worker → Video generation: calls per video (evidence: `server.py`)
- Video generation → Google Flow: drives browser
- Run worker → Run state: updates status (evidence: `server.py`)
- Run worker → Analytics file: updates analytics (evidence: `server.py`)
- Analytics view → Analytics file: views metrics
- Flask API → Log buffer: reads logs (evidence: `server.py`)
- Flask API → SSE stream: opens stream (evidence: `server.py`)
- Event broadcast → SSE stream: queues events (evidence: `server.py`)
- SSE stream → Automation UI: streams updates
