# jonathanjing/sermon-video-zh-subtitles architecture

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

- Interactive diagram: https://gitdiagram.com/jonathanjing/sermon-video-zh-subtitles
- Repository: https://github.com/jonathanjing/sermon-video-zh-subtitles

## Overview

Tongxing is a sermon-access product with prepared multilingual dubbing as its featured workflow, alongside separate Sunday live-caption and listening-app experiences. The README documents the four production stages and their release gates; sampled source confirms pieces of live processing, verified catalog loading, and playback/storage behavior. The graph preserves documented subsystems, but omits uncertain internal wiring where source was not sampled.

Main entry points: [`backend/realtime.py`](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/realtime.py) (Realtime pipeline), [`apps/tongxing-ios/App/AppModel.swift`](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/AppModel.swift) (App state), [`web/app.js`](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/web/app.js) (Live caption interface), [`scripts/build_english_source_package.py`](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/build_english_source_package.py) (English anchors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_production["Prepared Production"]
  node_english["English anchors"]
  node_target_text["Target text"]
  node_target_audio["Audio synchronization"]
  node_release["Release packaging"]
  node_release_host["Multilingual hosting"]
  node_dual_pdf["Dual-PDF workflow"]
end

subgraph group_live["Live Captions"]
  node_live_web["Live caption interface<br/>[app.js]"]
  node_live_api["Live session API<br/>[app.py]"]
  node_live_pipeline["Realtime pipeline<br/>[realtime.py]"]
  node_live_worker["Media worker<br/>[worker.py]"]
end

subgraph group_delivery["Listening Delivery"]
  node_ios_app["iOS listening app<br/>[ContentView.swift]"]
  node_ios_model["App state<br/>[AppModel.swift]"]
  node_ios_catalog["Catalog repositories"]
  node_ios_playback["Audio playback"]
  node_ios_offline[("Offline library")]
  node_fingerprint["Audio alignment"]
  node_web_player["Web sermon player<br/>[app.mjs]"]
  node_dev_player["Dev multilingual player<br/>[app.js]"]
end

subgraph group_platform["Runtime Services"]
  node_live_state[("Session progress<br/>[progress.py]")]
  node_live_storage[("Artifact storage<br/>[storage.py]")]
  node_media_host["Firebase hosting"]
end

node_producer(("Production operator"))
node_live_operator(("Sunday operator"))
node_listener(("Listener"))

node_producer -->|"prepare source"| node_english
node_english -->|"anchors text"| node_target_text
node_target_text -->|"approved text"| node_target_audio
node_target_audio -->|"audio and captions"| node_release
node_release -->|"publish assets"| node_release_host
node_live_operator -->|"prepare session"| node_live_web
node_live_web -->|"session requests"| node_live_api
node_live_api -->|"dispatch audio"| node_live_pipeline
node_live_pipeline -->|"process stream"| node_live_worker
node_live_pipeline -->|"record progress"| node_live_state
node_live_worker -->|"read artifacts"| node_live_storage
node_live_pipeline -->|"caption events"| node_live_web
node_listener -->|"choose sermon"| node_ios_app
node_ios_app -->|"user actions"| node_ios_model
node_ios_model -->|"load catalog"| node_ios_catalog
node_ios_model -->|"control playback"| node_ios_playback
node_ios_model -->|"manage downloads"| node_ios_offline
node_ios_playback -->|"align audio"| node_fingerprint
node_listener -.->|"listen"| node_web_player
node_listener -.->|"preview content"| node_dev_player
node_dev_player -.->|"fetch assets"| node_media_host
node_release_host -->|"deploy release"| node_media_host
node_producer -.->|"produce PDFs"| node_dual_pdf

click node_english "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/build_english_source_package.py"
click node_target_text "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/translate_playback_with_openai.py"
click node_target_audio "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/render_formal_target_language_speech.py"
click node_release "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/build_formal_dev_release_assets.py"
click node_release_host "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/deploy_multilingual_hosting.py"
click node_live_web "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/web/app.js"
click node_live_api "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/app.py"
click node_live_pipeline "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/realtime.py"
click node_live_worker "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/worker.py"
click node_live_state "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/progress.py"
click node_live_storage "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/storage.py"
click node_ios_app "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/ContentView.swift"
click node_ios_model "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/AppModel.swift"
click node_ios_catalog "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Infrastructure/MultilingualCatalogRepository.swift"
click node_ios_playback "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/PlaybackController.swift"
click node_ios_offline "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Infrastructure/OfflineLibrary.swift"
click node_fingerprint "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Core/Sources/TongxingCore/FingerprintMatcher.swift"
click node_web_player "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/experiments/sermon-dubbing-poc/web/app.mjs"
click node_dev_player "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/firebase/dev/public/app.js"
click node_dual_pdf "https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/sermon_end_to_end.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_english,node_target_text,node_target_audio,node_release,node_release_host,node_dual_pdf toneBlue
class node_live_web,node_live_api,node_live_pipeline,node_live_worker toneAmber
class node_ios_app,node_ios_model,node_ios_catalog,node_ios_playback,node_ios_offline,node_fingerprint,node_web_player,node_dev_player toneMint
class node_live_state,node_live_storage,node_media_host toneRose
class node_producer,node_live_operator,node_listener toneIndigo
```

## Components

### Prepared Production

- [English anchors](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/build_english_source_package.py): `scripts/build_english_source_package.py`
- [Target text](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/translate_playback_with_openai.py): `scripts/translate_playback_with_openai.py`
- [Audio synchronization](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/render_formal_target_language_speech.py): `scripts/render_formal_target_language_speech.py`
- [Release packaging](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/build_formal_dev_release_assets.py): `scripts/build_formal_dev_release_assets.py`
- [Multilingual hosting](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/deploy_multilingual_hosting.py): `scripts/deploy_multilingual_hosting.py`
- [Dual-PDF workflow](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/scripts/sermon_end_to_end.py): `scripts/sermon_end_to_end.py`

### Live Captions

- [Live caption interface](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/web/app.js): `web/app.js`
- [Live session API](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/app.py): `backend/app.py`
- [Realtime pipeline](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/realtime.py): `backend/realtime.py`
- [Media worker](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/worker.py): `backend/worker.py`

### Listening Delivery

- [iOS listening app](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/ContentView.swift): `apps/tongxing-ios/App/ContentView.swift`
- [App state](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/AppModel.swift): `apps/tongxing-ios/App/AppModel.swift`
- [Catalog repositories](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Infrastructure/MultilingualCatalogRepository.swift): `apps/tongxing-ios/Infrastructure/MultilingualCatalogRepository.swift`
- [Audio playback](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/App/PlaybackController.swift): `apps/tongxing-ios/App/PlaybackController.swift`
- [Offline library](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Infrastructure/OfflineLibrary.swift): `apps/tongxing-ios/Infrastructure/OfflineLibrary.swift`
- [Audio alignment](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/apps/tongxing-ios/Core/Sources/TongxingCore/FingerprintMatcher.swift): `apps/tongxing-ios/Core/Sources/TongxingCore/FingerprintMatcher.swift`
- [Web sermon player](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/experiments/sermon-dubbing-poc/web/app.mjs): `experiments/sermon-dubbing-poc/web/app.mjs`
- [Dev multilingual player](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/firebase/dev/public/app.js): `firebase/dev/public/app.js`

### Runtime Services

- [Session progress](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/progress.py): `backend/progress.py`
- [Artifact storage](https://github.com/jonathanjing/sermon-video-zh-subtitles/blob/main/backend/storage.py): `backend/storage.py`
- **Firebase hosting**

### Other components

- **Production operator**
- **Sunday operator**
- **Listener**

## Connections

- Production operator → English anchors: prepare source
- English anchors → Target text: anchors text
- Target text → Audio synchronization: approved text
- Audio synchronization → Release packaging: audio and captions
- Release packaging → Multilingual hosting: publish assets
- Sunday operator → Live caption interface: prepare session
- Live caption interface → Live session API: session requests
- Live session API → Realtime pipeline: dispatch audio
- Realtime pipeline → Media worker: process stream
- Realtime pipeline → Session progress: record progress
- Media worker → Artifact storage: read artifacts
- Realtime pipeline → Live caption interface: caption events
- Listener → iOS listening app: choose sermon
- iOS listening app → App state: user actions
- App state → Catalog repositories: load catalog
- App state → Audio playback: control playback
- App state → Offline library: manage downloads
- Audio playback → Audio alignment: align audio
- Listener → Web sermon player: listen
- Listener → Dev multilingual player: preview content
- Dev multilingual player → Firebase hosting: fetch assets
- Multilingual hosting → Firebase hosting: deploy release
- Production operator → Dual-PDF workflow: produce PDFs
