# suhailsaqan/swae architecture

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

- Interactive diagram: https://gitdiagram.com/suhailsaqan/swae
- Repository: https://github.com/suhailsaqan/swae

## Overview

Swae is an iPhone live-streaming studio built around Nostr identity and Lightning payments. The primary workflow is account setup, stream configuration and broadcast, then audience interaction through chat and zaps; discovery and playback form a parallel audience workflow. The graph also preserves documented effects, collaboration, hardware, dashboard, and Watch capabilities. Several capabilities are represented by their exact enclosing directories because their implementation files were not sampled; those links rely on README descriptions rather than inspected call sites.

Main entry points: [`swae/Controllers/AppState.swift`](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/AppState.swift) (Nostr App State), [`swae/Controllers/Camera/CameraViewController.swift`](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/Camera/CameraViewController.swift) (Camera Studio), [`swae/Media`](https://github.com/suhailsaqan/swae/tree/main/swae/Media) (Media Pipeline), [`swae/GenericLivePlayer/Controllers/LiveChatController.swift`](https://github.com/suhailsaqan/swae/blob/main/swae/GenericLivePlayer/Controllers/LiveChatController.swift) (Live Chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and Identity"]
  node_app_shell["App Shell"]
  node_app_state["Nostr App State<br/>[AppState.swift]"]
  node_onboarding["Account Setup"]
  node_profile["Profiles"]
  node_nostr_events["Nostr Events"]
end

subgraph group_broadcast["Broadcast Studio"]
  node_camera["Camera Studio"]
  node_media_pipeline["Media Pipeline"]
  node_effects["Video Effects"]
  node_stream_protocols["Stream Protocols"]
  node_adaptive_bitrate["Adaptive Bitrate"]
  node_control_panel["Streamer Dashboard"]
end

subgraph group_audience["Audience and Social"]
  node_discovery["Stream Discovery"]
  node_player["Live Player"]
  node_live_chat["Live Chat"]
end

subgraph group_payments["Wallet and Payments"]
  node_wallet["Lightning Wallet<br/>[WalletModel.swift]"]
  node_zap["Zap Payments<br/>[ZapService.swift]"]
end

subgraph group_extensions["Integrations and Companions"]
  node_collaboration["Guest Collaboration"]
  node_hardware["Hardware Devices"]
  node_watch["Apple Watch App"]
end

node_creator(("Creator"))
node_viewer(("Viewer"))
node_external_relays{{"Nostr Relays"}}
node_external_wallets{{"Lightning Wallet Services"}}

node_creator -->|"creates account"| node_onboarding
node_onboarding -.->|"sets identity"| node_app_state
node_app_shell -->|"sets up"| node_app_state
node_app_state -->|"processes events"| node_nostr_events
node_profile -->|"reads profile state"| node_app_state
node_viewer -->|"browses streams"| node_discovery
node_discovery -.->|"opens playback"| node_player
node_creator -->|"configures broadcast"| node_camera
node_camera -.->|"captures media"| node_media_pipeline
node_media_pipeline -->|"composites effects"| node_effects
node_media_pipeline -.->|"encodes and streams"| node_stream_protocols
node_camera -->|"adjusts bitrate"| node_adaptive_bitrate
node_camera -->|"opens controls"| node_control_panel
node_viewer -->|"watches stream"| node_player
node_player -->|"shows live chat"| node_live_chat
node_live_chat -->|"publishes messages"| node_app_state
node_app_state -->|"publishes events"| node_external_relays
node_live_chat -->|"initiates zaps"| node_zap
node_zap -.->|"uses wallet"| node_wallet
node_wallet -->|"connects wallet"| node_external_wallets
node_camera -->|"coordinates guests"| node_collaboration
node_camera -->|"uses device sources"| node_hardware
node_app_state -.->|"shares stream controls"| node_watch

click node_app_shell "https://github.com/suhailsaqan/swae/blob/main/swae/RootViewController.swift"
click node_app_state "https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/AppState.swift"
click node_onboarding "https://github.com/suhailsaqan/swae/tree/main/swae/Controllers/Onboarding"
click node_profile "https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/ProfileViewController.swift"
click node_discovery "https://github.com/suhailsaqan/swae/blob/main/swae/Views/VideoListViewController.swift"
click node_camera "https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/Camera/CameraViewController.swift"
click node_media_pipeline "https://github.com/suhailsaqan/swae/tree/main/swae/Media"
click node_effects "https://github.com/suhailsaqan/swae/tree/main/swae/VideoEffects"
click node_stream_protocols "https://github.com/suhailsaqan/swae/tree/main/swae/Media/HaishinKit"
click node_adaptive_bitrate "https://github.com/suhailsaqan/swae/tree/main/swae/Media/AdaptiveBitrate"
click node_control_panel "https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/ControlPanel/ControlPanelViewController.swift"
click node_player "https://github.com/suhailsaqan/swae/blob/main/swae/GenericLivePlayer/Controllers/PlayerController.swift"
click node_live_chat "https://github.com/suhailsaqan/swae/blob/main/swae/GenericLivePlayer/Controllers/LiveChatController.swift"
click node_nostr_events "https://github.com/suhailsaqan/swae/blob/main/swae/Services/RelayEventProcessor.swift"
click node_wallet "https://github.com/suhailsaqan/swae/blob/main/swae/Models/WalletModel.swift"
click node_zap "https://github.com/suhailsaqan/swae/blob/main/swae/Services/ZapService.swift"
click node_collaboration "https://github.com/suhailsaqan/swae/blob/main/swae/Services/CallSignalingService.swift"
click node_hardware "https://github.com/suhailsaqan/swae/tree/main/swae/Integrations"
click node_watch "https://github.com/suhailsaqan/swae/tree/main/Swae%20Watch%20Watch%20App"

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_app_shell,node_app_state,node_onboarding,node_profile,node_nostr_events,node_viewer toneBlue
class node_camera,node_media_pipeline,node_effects,node_stream_protocols,node_adaptive_bitrate,node_control_panel toneAmber
class node_discovery,node_player,node_live_chat toneMint
class node_wallet,node_zap toneRose
class node_collaboration,node_hardware,node_watch,node_creator,node_external_relays,node_external_wallets toneIndigo
```

## Components

### App and Identity

- [App Shell](https://github.com/suhailsaqan/swae/blob/main/swae/RootViewController.swift): `swae/RootViewController.swift`
- [Nostr App State](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/AppState.swift): `swae/Controllers/AppState.swift`
- [Account Setup](https://github.com/suhailsaqan/swae/tree/main/swae/Controllers/Onboarding): `swae/Controllers/Onboarding`
- [Profiles](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/ProfileViewController.swift): `swae/Controllers/ProfileViewController.swift`
- [Nostr Events](https://github.com/suhailsaqan/swae/blob/main/swae/Services/RelayEventProcessor.swift): `swae/Services/RelayEventProcessor.swift`

### Broadcast Studio

- [Camera Studio](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/Camera/CameraViewController.swift): `swae/Controllers/Camera/CameraViewController.swift`
- [Media Pipeline](https://github.com/suhailsaqan/swae/tree/main/swae/Media): `swae/Media`
- [Video Effects](https://github.com/suhailsaqan/swae/tree/main/swae/VideoEffects): `swae/VideoEffects`
- [Stream Protocols](https://github.com/suhailsaqan/swae/tree/main/swae/Media/HaishinKit): `swae/Media/HaishinKit`
- [Adaptive Bitrate](https://github.com/suhailsaqan/swae/tree/main/swae/Media/AdaptiveBitrate): `swae/Media/AdaptiveBitrate`
- [Streamer Dashboard](https://github.com/suhailsaqan/swae/blob/main/swae/Controllers/ControlPanel/ControlPanelViewController.swift): `swae/Controllers/ControlPanel/ControlPanelViewController.swift`

### Audience and Social

- [Stream Discovery](https://github.com/suhailsaqan/swae/blob/main/swae/Views/VideoListViewController.swift): `swae/Views/VideoListViewController.swift`
- [Live Player](https://github.com/suhailsaqan/swae/blob/main/swae/GenericLivePlayer/Controllers/PlayerController.swift): `swae/GenericLivePlayer/Controllers/PlayerController.swift`
- [Live Chat](https://github.com/suhailsaqan/swae/blob/main/swae/GenericLivePlayer/Controllers/LiveChatController.swift): `swae/GenericLivePlayer/Controllers/LiveChatController.swift`

### Wallet and Payments

- [Lightning Wallet](https://github.com/suhailsaqan/swae/blob/main/swae/Models/WalletModel.swift): `swae/Models/WalletModel.swift`
- [Zap Payments](https://github.com/suhailsaqan/swae/blob/main/swae/Services/ZapService.swift): `swae/Services/ZapService.swift`

### Integrations and Companions

- [Guest Collaboration](https://github.com/suhailsaqan/swae/blob/main/swae/Services/CallSignalingService.swift): `swae/Services/CallSignalingService.swift`
- [Hardware Devices](https://github.com/suhailsaqan/swae/tree/main/swae/Integrations): `swae/Integrations`
- [Apple Watch App](https://github.com/suhailsaqan/swae/tree/main/Swae%20Watch%20Watch%20App): `Swae Watch Watch App`

### Other components

- **Creator**
- **Viewer**
- **Nostr Relays**
- **Lightning Wallet Services**

## Connections

- Creator → Account Setup: creates account
- Account Setup → Nostr App State: sets identity (evidence: `swae/Controllers/Onboarding/CreateProfileViewController.swift`)
- App Shell → Nostr App State: sets up (evidence: `swae/RootViewController.swift`)
- Nostr App State → Nostr Events: processes events (evidence: `swae/Controllers/AppState.swift`)
- Profiles → Nostr App State: reads profile state (evidence: `swae/Controllers/ProfileViewController.swift`)
- Viewer → Stream Discovery: browses streams
- Stream Discovery → Live Player: opens playback
- Creator → Camera Studio: configures broadcast
- Camera Studio → Media Pipeline: captures media
- Media Pipeline → Video Effects: composites effects
- Media Pipeline → Stream Protocols: encodes and streams (evidence: `swae/Media/RtspClient/RtspClient.swift`)
- Camera Studio → Adaptive Bitrate: adjusts bitrate
- Camera Studio → Streamer Dashboard: opens controls
- Viewer → Live Player: watches stream
- Live Player → Live Chat: shows live chat (evidence: `swae/GenericLivePlayer/Controllers/LiveChatController.swift`)
- Live Chat → Nostr App State: publishes messages (evidence: `swae/GenericLivePlayer/Controllers/LiveChatController.swift`)
- Nostr App State → Nostr Relays: publishes events (evidence: `swae/Controllers/AppState.swift`)
- Live Chat → Zap Payments: initiates zaps (evidence: `swae/GenericLivePlayer/Controllers/LiveChatController.swift`)
- Zap Payments → Lightning Wallet: uses wallet
- Lightning Wallet → Lightning Wallet Services: connects wallet
- Camera Studio → Guest Collaboration: coordinates guests
- Camera Studio → Hardware Devices: uses device sources (evidence: `swae/Controllers/Camera/CameraViewController.swift`)
- Nostr App State → Apple Watch App: shares stream controls
