# harika88388/streamflow architecture

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

- Interactive diagram: https://gitdiagram.com/harika88388/streamflow
- Repository: https://github.com/harika88388/streamflow

## Overview

StreamFlow is an anonymous video library and adaptive-streaming platform. A viewer uploads a video in resumable chunks; the API finalizes it and schedules processing, which probes the source, generates thumbnail assets, transcodes an HLS quality ladder, and records readiness. The browser then plays HLS with buffer-aware quality selection and sends playback events for analytics. The graph also includes library/status and media delivery. Relationships follow excerpts, the source index, or README documentation; unsampled implementation details are not inferred.

Main entry points: [`app/workers/video_worker.py`](https://github.com/harika88388/streamflow/blob/main/app/workers/video_worker.py) (Processing worker), [`app/api/routes/videos.py`](https://github.com/harika88388/streamflow/blob/main/app/api/routes/videos.py) (Video API), [`app/services/upload_service.py`](https://github.com/harika88388/streamflow/blob/main/app/services/upload_service.py) (Chunked uploads), [`app/api/routes/uploads.py`](https://github.com/harika88388/streamflow/blob/main/app/api/routes/uploads.py) (Upload API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Upload and library"]
  node_video_routes["Video API<br/>[videos.py]"]
  node_upload_routes["Upload API<br/>[uploads.py]"]
  node_upload_service["Chunked uploads<br/>[upload_service.py]"]
  node_video_service["Video metadata<br/>[video_service.py]"]
  node_upload_models[("Upload records<br/>[upload_session.py]")]
  node_video_models[("Video records<br/>[video.py]")]
end

subgraph group_processing["Media processing"]
  node_worker["Processing worker<br/>[video_worker.py]"]
  node_transcoding["Transcode and HLS"]
  node_thumbnail["Thumbnail generation"]
  node_media_disk[("Local media storage")]
end

subgraph group_playback["Playback and delivery"]
  node_streaming_routes["Media delivery<br/>[streaming.py]"]
  node_player["Web player and library<br/>[player.js]"]
  node_abr["ABR decisions<br/>[abr_service.py]"]
  node_variants[("HLS variants<br/>[video_variant.py]")]
end

subgraph group_operations["Status and analytics"]
  node_progress_routes["Status API<br/>[progress.py]"]
  node_progress_service["Processing progress"]
  node_analytics_routes["Analytics API<br/>[analytics.py]"]
  node_analytics_service["Playback analytics"]
  node_events[("Playback events<br/>[playback_event.py]")]
  node_database["SQL database sessions<br/>[database.py]"]
end

node_browser(("Browser"))

node_browser -->|"uploads chunks"| node_upload_routes
node_upload_routes -->|"delegates upload"| node_upload_service
node_upload_service -->|"tracks chunks"| node_upload_models
node_upload_service -->|"assembles file"| node_media_disk
node_upload_routes -->|"schedules processing"| node_worker
node_browser -->|"browses library"| node_video_routes
node_video_routes -->|"delegates metadata"| node_video_service
node_video_service -->|"reads and updates"| node_video_models
node_worker -->|"updates processing state"| node_video_service
node_worker -->|"probes and transcodes"| node_transcoding
node_worker -->|"generates previews"| node_thumbnail
node_transcoding -->|"writes HLS output"| node_media_disk
node_thumbnail -->|"writes image assets"| node_media_disk
node_worker -.->|"records renditions"| node_variants
node_browser -->|"fetches media"| node_streaming_routes
node_streaming_routes -->|"serves playlists and assets"| node_media_disk
node_player -->|"requests HLS assets"| node_streaming_routes
node_player -->|"selects quality"| node_abr
node_video_routes -->|"reads playback renditions"| node_variants
node_browser -->|"checks processing status"| node_progress_routes
node_progress_routes -->|"delegates status"| node_progress_service
node_progress_service -->|"reads progress state"| node_video_models
node_browser -->|"submits playback events"| node_analytics_routes
node_analytics_routes -->|"delegates analytics"| node_analytics_service
node_analytics_service -->|"stores and queries events"| node_events
node_video_routes -->|"uses request sessions"| node_database
node_upload_service -.->|"persists upload records"| node_database

click node_video_routes "https://github.com/harika88388/streamflow/blob/main/app/api/routes/videos.py"
click node_upload_routes "https://github.com/harika88388/streamflow/blob/main/app/api/routes/uploads.py"
click node_upload_service "https://github.com/harika88388/streamflow/blob/main/app/services/upload_service.py"
click node_video_service "https://github.com/harika88388/streamflow/blob/main/app/services/video_service.py"
click node_upload_models "https://github.com/harika88388/streamflow/blob/main/app/db/models/upload_session.py"
click node_video_models "https://github.com/harika88388/streamflow/blob/main/app/db/models/video.py"
click node_worker "https://github.com/harika88388/streamflow/blob/main/app/workers/video_worker.py"
click node_transcoding "https://github.com/harika88388/streamflow/blob/main/app/services/transcoding_service.py"
click node_thumbnail "https://github.com/harika88388/streamflow/blob/main/app/services/thumbnail_service.py"
click node_streaming_routes "https://github.com/harika88388/streamflow/blob/main/app/api/routes/streaming.py"
click node_player "https://github.com/harika88388/streamflow/blob/main/app/static/player.js"
click node_abr "https://github.com/harika88388/streamflow/blob/main/app/services/abr_service.py"
click node_variants "https://github.com/harika88388/streamflow/blob/main/app/db/models/video_variant.py"
click node_progress_routes "https://github.com/harika88388/streamflow/blob/main/app/api/routes/progress.py"
click node_progress_service "https://github.com/harika88388/streamflow/blob/main/app/services/progress_service.py"
click node_analytics_routes "https://github.com/harika88388/streamflow/blob/main/app/api/routes/analytics.py"
click node_analytics_service "https://github.com/harika88388/streamflow/blob/main/app/services/analytics_service.py"
click node_events "https://github.com/harika88388/streamflow/blob/main/app/db/models/playback_event.py"
click node_database "https://github.com/harika88388/streamflow/blob/main/app/db/database.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_video_routes,node_upload_routes,node_upload_service,node_video_service,node_upload_models,node_video_models,node_browser toneBlue
class node_worker,node_transcoding,node_thumbnail,node_media_disk toneAmber
class node_streaming_routes,node_player,node_abr,node_variants toneMint
class node_progress_routes,node_progress_service,node_analytics_routes,node_analytics_service,node_events,node_database toneRose
```

## Components

### Upload and library

- [Video API](https://github.com/harika88388/streamflow/blob/main/app/api/routes/videos.py): `app/api/routes/videos.py`
- [Upload API](https://github.com/harika88388/streamflow/blob/main/app/api/routes/uploads.py): `app/api/routes/uploads.py`
- [Chunked uploads](https://github.com/harika88388/streamflow/blob/main/app/services/upload_service.py): `app/services/upload_service.py`
- [Video metadata](https://github.com/harika88388/streamflow/blob/main/app/services/video_service.py): `app/services/video_service.py`
- [Upload records](https://github.com/harika88388/streamflow/blob/main/app/db/models/upload_session.py): `app/db/models/upload_session.py`
- [Video records](https://github.com/harika88388/streamflow/blob/main/app/db/models/video.py): `app/db/models/video.py`

### Media processing

- [Processing worker](https://github.com/harika88388/streamflow/blob/main/app/workers/video_worker.py): `app/workers/video_worker.py`
- [Transcode and HLS](https://github.com/harika88388/streamflow/blob/main/app/services/transcoding_service.py): `app/services/transcoding_service.py`
- [Thumbnail generation](https://github.com/harika88388/streamflow/blob/main/app/services/thumbnail_service.py): `app/services/thumbnail_service.py`
- **Local media storage**

### Playback and delivery

- [Media delivery](https://github.com/harika88388/streamflow/blob/main/app/api/routes/streaming.py): `app/api/routes/streaming.py`
- [Web player and library](https://github.com/harika88388/streamflow/blob/main/app/static/player.js): `app/static/player.js`
- [ABR decisions](https://github.com/harika88388/streamflow/blob/main/app/services/abr_service.py): `app/services/abr_service.py`
- [HLS variants](https://github.com/harika88388/streamflow/blob/main/app/db/models/video_variant.py): `app/db/models/video_variant.py`

### Status and analytics

- [Status API](https://github.com/harika88388/streamflow/blob/main/app/api/routes/progress.py): `app/api/routes/progress.py`
- [Processing progress](https://github.com/harika88388/streamflow/blob/main/app/services/progress_service.py): `app/services/progress_service.py`
- [Analytics API](https://github.com/harika88388/streamflow/blob/main/app/api/routes/analytics.py): `app/api/routes/analytics.py`
- [Playback analytics](https://github.com/harika88388/streamflow/blob/main/app/services/analytics_service.py): `app/services/analytics_service.py`
- [Playback events](https://github.com/harika88388/streamflow/blob/main/app/db/models/playback_event.py): `app/db/models/playback_event.py`
- [SQL database sessions](https://github.com/harika88388/streamflow/blob/main/app/db/database.py): `app/db/database.py`

### Other components

- **Browser**

## Connections

- Browser → Upload API: uploads chunks (evidence: `README.md`)
- Upload API → Chunked uploads: delegates upload (evidence: `app/api/routes/uploads.py`)
- Chunked uploads → Upload records: tracks chunks (evidence: `app/services/upload_service.py`)
- Chunked uploads → Local media storage: assembles file (evidence: `app/services/upload_service.py`)
- Upload API → Processing worker: schedules processing (evidence: `app/api/routes/uploads.py`)
- Browser → Video API: browses library (evidence: `README.md`)
- Video API → Video metadata: delegates metadata (evidence: `app/api/routes/videos.py`)
- Video metadata → Video records: reads and updates (evidence: `app/services/video_service.py`)
- Processing worker → Video metadata: updates processing state (evidence: `app/workers/video_worker.py`)
- Processing worker → Transcode and HLS: probes and transcodes (evidence: `app/workers/video_worker.py`)
- Processing worker → Thumbnail generation: generates previews (evidence: `app/workers/video_worker.py`)
- Transcode and HLS → Local media storage: writes HLS output (evidence: `README.md`)
- Thumbnail generation → Local media storage: writes image assets (evidence: `README.md`)
- Processing worker → HLS variants: records renditions
- Browser → Media delivery: fetches media (evidence: `README.md`)
- Media delivery → Local media storage: serves playlists and assets (evidence: `README.md`)
- Web player and library → Media delivery: requests HLS assets (evidence: `README.md`)
- Web player and library → ABR decisions: selects quality (evidence: `README.md`)
- Video API → HLS variants: reads playback renditions (evidence: `app/api/routes/videos.py`)
- Browser → Status API: checks processing status (evidence: `README.md`)
- Status API → Processing progress: delegates status (evidence: `app/api/routes/progress.py`)
- Processing progress → Video records: reads progress state (evidence: `app/services/progress_service.py`)
- Browser → Analytics API: submits playback events (evidence: `README.md`)
- Analytics API → Playback analytics: delegates analytics (evidence: `app/api/routes/analytics.py`)
- Playback analytics → Playback events: stores and queries events (evidence: `app/services/analytics_service.py`)
- Video API → SQL database sessions: uses request sessions (evidence: `app/api/routes/videos.py`)
- Chunked uploads → SQL database sessions: persists upload records
