# adilevy1011/streaming architecture

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

- Interactive diagram: https://gitdiagram.com/adilevy1011/streaming
- Repository: https://github.com/adilevy1011/streaming

## Overview

ADLV Media Streamer serves a browser media library and player through a FastAPI API, with Supabase providing authentication, media storage, and playback metadata. The main workflow is sign in, browse the media catalog, stream a selected video, and save or resume playback progress; playback also supports subtitles, timeline previews, and credit-aware completion. Separate maintenance scripts generate preview sheets and detect credit timestamps. Some backend routes and database details are documented but not present in the sampled source, so uncertain connections are omitted.

Main entry points: [`backend/main.py`](https://github.com/adilevy1011/streaming/blob/main/backend/main.py) (FastAPI app), [`scripts/detect_credits.py`](https://github.com/adilevy1011/streaming/blob/main/scripts/detect_credits.py) (Credit detector), [`frontend/app.js`](https://github.com/adilevy1011/streaming/blob/main/frontend/app.js) (Media library), [`frontend/watch.js`](https://github.com/adilevy1011/streaming/blob/main/frontend/watch.js) (Video player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_library["Media library<br/>[app.js]"]
  node_player["Video player<br/>[watch.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_library_page["Library page<br/>[index.html]"]
  node_watch_page["Player page<br/>[watch.html]"]
end

subgraph group_api["Backend API"]
  node_fastapi["FastAPI app<br/>[main.py]"]
end

subgraph group_services["Supabase services"]
  node_auth["Supabase Auth"]
  node_rest["Supabase REST"]
  node_storage["Supabase Storage"]
  node_catalog[("Media catalog")]
  node_progress[("Playback progress")]
  node_previews[("Preview manifests")]
  node_credits[("Credit timestamps")]
  node_profiles[("User profiles")]
end

subgraph group_maintenance["Media processing"]
  node_preview_worker["Preview generator"]
  node_credit_detector["Credit detector<br/>[detect_credits.py]"]
  node_model["MobileNet model"]
end

node_viewer(("Viewer"))

node_viewer -->|"opens library"| node_library_page
node_viewer -->|"opens player"| node_watch_page
node_library_page -->|"loads"| node_library
node_watch_page -->|"loads"| node_player
node_library -->|"requests data"| node_api_client
node_player -->|"requests playback data"| node_api_client
node_api_client -->|"calls API"| node_fastapi
node_library -->|"streams catalog"| node_fastapi
node_player -->|"fetches media"| node_fastapi
node_fastapi -->|"authenticates"| node_auth
node_fastapi -->|"queries metadata"| node_rest
node_fastapi -->|"streams objects"| node_storage
node_rest -->|"reads catalog"| node_catalog
node_rest -->|"reads/writes progress"| node_progress
node_rest -->|"reads manifests"| node_previews
node_rest -->|"reads timestamps"| node_credits
node_rest -->|"reads/writes profile"| node_profiles
node_preview_worker -->|"reads videos, uploads sheets"| node_storage
node_preview_worker -->|"writes manifests"| node_previews
node_credit_detector -->|"reads manifests"| node_previews
node_credit_detector -->|"reads media objects"| node_storage
node_credit_detector -->|"writes timestamps"| node_credits
node_credit_detector -.->|"loads verifier"| node_model

click node_library "https://github.com/adilevy1011/streaming/blob/main/frontend/app.js"
click node_player "https://github.com/adilevy1011/streaming/blob/main/frontend/watch.js"
click node_api_client "https://github.com/adilevy1011/streaming/blob/main/frontend/api.js"
click node_library_page "https://github.com/adilevy1011/streaming/blob/main/frontend/index.html"
click node_watch_page "https://github.com/adilevy1011/streaming/blob/main/frontend/watch.html"
click node_fastapi "https://github.com/adilevy1011/streaming/blob/main/backend/main.py"
click node_catalog "https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260923200000_create_media_catalog.sql"
click node_progress "https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260920000000_create_video_progress.sql"
click node_previews "https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260921000000_create_video_previews.sql"
click node_credits "https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260923160957_create_video_credits_table.sql"
click node_profiles "https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260922130000_create_profiles.sql"
click node_preview_worker "https://github.com/adilevy1011/streaming/blob/main/scripts/generate_previews.py"
click node_credit_detector "https://github.com/adilevy1011/streaming/blob/main/scripts/detect_credits.py"
click node_model "https://github.com/adilevy1011/streaming/blob/main/models/credit_mobilenet.pt"

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_library,node_player,node_api_client,node_library_page,node_watch_page,node_viewer toneBlue
class node_fastapi toneAmber
class node_auth,node_rest,node_storage,node_catalog,node_progress,node_previews,node_credits,node_profiles toneMint
class node_preview_worker,node_credit_detector,node_model toneRose
```

## Components

### Browser experience

- [Media library](https://github.com/adilevy1011/streaming/blob/main/frontend/app.js): `frontend/app.js`
- [Video player](https://github.com/adilevy1011/streaming/blob/main/frontend/watch.js): `frontend/watch.js`
- [API client](https://github.com/adilevy1011/streaming/blob/main/frontend/api.js): `frontend/api.js`
- [Library page](https://github.com/adilevy1011/streaming/blob/main/frontend/index.html): `frontend/index.html`
- [Player page](https://github.com/adilevy1011/streaming/blob/main/frontend/watch.html): `frontend/watch.html`

### Backend API

- [FastAPI app](https://github.com/adilevy1011/streaming/blob/main/backend/main.py): `backend/main.py`

### Supabase services

- **Supabase Auth**
- **Supabase REST**
- **Supabase Storage**
- [Media catalog](https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260923200000_create_media_catalog.sql): `supabase/migrations/20260923200000_create_media_catalog.sql`
- [Playback progress](https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260920000000_create_video_progress.sql): `supabase/migrations/20260920000000_create_video_progress.sql`
- [Preview manifests](https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260921000000_create_video_previews.sql): `supabase/migrations/20260921000000_create_video_previews.sql`
- [Credit timestamps](https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260923160957_create_video_credits_table.sql): `supabase/migrations/20260923160957_create_video_credits_table.sql`
- [User profiles](https://github.com/adilevy1011/streaming/blob/main/supabase/migrations/20260922130000_create_profiles.sql): `supabase/migrations/20260922130000_create_profiles.sql`

### Media processing

- [Preview generator](https://github.com/adilevy1011/streaming/blob/main/scripts/generate_previews.py): `scripts/generate_previews.py`
- [Credit detector](https://github.com/adilevy1011/streaming/blob/main/scripts/detect_credits.py): `scripts/detect_credits.py`
- [MobileNet model](https://github.com/adilevy1011/streaming/blob/main/models/credit_mobilenet.pt): `models/credit_mobilenet.pt`

### Other components

- **Viewer**

## Connections

- Viewer → Library page: opens library
- Viewer → Player page: opens player
- Library page → Media library: loads
- Player page → Video player: loads
- Media library → API client: requests data
- Video player → API client: requests playback data
- API client → FastAPI app: calls API
- Media library → FastAPI app: streams catalog
- Video player → FastAPI app: fetches media
- FastAPI app → Supabase Auth: authenticates
- FastAPI app → Supabase REST: queries metadata
- FastAPI app → Supabase Storage: streams objects
- Supabase REST → Media catalog: reads catalog
- Supabase REST → Playback progress: reads/writes progress
- Supabase REST → Preview manifests: reads manifests
- Supabase REST → Credit timestamps: reads timestamps
- Supabase REST → User profiles: reads/writes profile
- Preview generator → Supabase Storage: reads videos, uploads sheets
- Preview generator → Preview manifests: writes manifests
- Credit detector → Preview manifests: reads manifests
- Credit detector → Supabase Storage: reads media objects
- Credit detector → Credit timestamps: writes timestamps
- Credit detector → MobileNet model: loads verifier
