# l33tdawg/freestream architecture

> Architecture diagram of the GitHub repository l33tdawg/freestream, 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/l33tdawg/freestream
- Repository: https://github.com/l33tdawg/freestream

## Overview

FreEstream is an Electron desktop app that accepts one local RTMP stream and fans it out to enabled streaming destinations through FFmpeg. The user configures destination URLs, keys, and encoding in the dashboard, then starts streaming from OBS or Streamlabs; the main process ingests the stream, launches per-destination FFmpeg processes, and reports status back to the UI. The README documents additional encoding, monitoring, preview, and reconnect capabilities. Some implementation details—especially keychain storage and renderer IPC wiring—were not excerpted, so those connections are shown only where the README or sampled references support them.

Main entry points: [`src/main/ffmpeg-manager.ts`](https://github.com/l33tdawg/freestream/blob/main/src/main/ffmpeg-manager.ts) (FFmpeg fan-out), [`src/main/ipc-handlers.ts`](https://github.com/l33tdawg/freestream/blob/main/src/main/ipc-handlers.ts) (IPC handlers), [`src/main/destination-manager.ts`](https://github.com/l33tdawg/freestream/blob/main/src/main/destination-manager.ts) (Destination management), [`src/main/index.ts`](https://github.com/l33tdawg/freestream/blob/main/src/main/index.ts) (Electron services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop orchestration"]
  node_main["Electron services<br/>[index.ts]"]
  node_ipc["IPC handlers<br/>[ipc-handlers.ts]"]
  node_preload["Preload bridge<br/>[preload.ts]"]
  node_shared["Shared contracts<br/>[types.ts]"]
end

subgraph group_streaming["Stream processing"]
  node_ingest["RTMP ingest<br/>[nms.ts]"]
  node_ffmpeg["FFmpeg fan-out<br/>[ffmpeg-manager.ts]"]
  node_ffmpegdetect["FFmpeg detection<br/>[ffmpeg-detector.ts]"]
  node_monitor["Stream monitoring<br/>[stream-monitor.ts]"]
end

subgraph group_renderer["Dashboard interface"]
  node_app["Application shell<br/>[App.tsx]"]
  node_dashboard["Streaming dashboard<br/>[Dashboard.tsx]"]
  node_destinationui["Destination cards and dialogs"]
  node_settingsui["Settings interface<br/>[SettingsDialog.tsx]"]
  node_ingestui["Ingest status and preview<br/>[IngestStatus.tsx]"]
  node_streamcontrols["Stream controls<br/>[StreamControls.tsx]"]
  node_console["Log console<br/>[ConsolePanel.tsx]"]
  node_statushook["Stream status hook<br/>[useStreamStatus.ts]"]
  node_desthook["Destinations hook<br/>[useDestinations.ts]"]
  node_loghook["App logs hook<br/>[useAppLogs.ts]"]
  node_theme["Theme provider<br/>[useTheme.tsx]"]
end

subgraph group_state["Configuration and state"]
  node_destmanager["Destination management"]
  node_config[("Settings and destinations<br/>[config.ts]")]
  node_presets["Platform presets<br/>[constants.ts]"]
  node_keys[("Stream key storage<br/>[secrets.ts]")]
end

node_streamer(("OBS / Streamlabs"))
node_platforms["Streaming platforms"]

node_streamer -->|"publishes RTMP"| node_ingest
node_ingest -->|"provides stream input"| node_ffmpeg
node_ffmpeg -->|"fans out streams"| node_platforms
node_main -->|"starts"| node_ingest
node_main -->|"initializes"| node_ffmpeg
node_main -->|"creates"| node_destmanager
node_main -->|"creates"| node_monitor
node_main -->|"registers"| node_ipc
node_ffmpeg -->|"reads settings"| node_config
node_ffmpeg -->|"detects encoders"| node_ffmpegdetect
node_ffmpeg -->|"reads stream key"| node_keys
node_ffmpeg -->|"sends outputs"| node_platforms
node_destmanager -->|"reads and writes"| node_config
node_destmanager -->|"uses platform defaults"| node_presets
node_destmanager -->|"deletes key"| node_keys
node_ipc -->|"handles destination actions"| node_destmanager
node_ipc -->|"starts and stops"| node_ffmpeg
node_ipc -->|"forwards status"| node_monitor
node_ipc -->|"handles settings"| node_config
node_ipc -->|"handles key actions"| node_keys
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_settingsui
node_dashboard -->|"renders"| node_destinationui
node_dashboard -->|"renders"| node_ingestui
node_dashboard -->|"renders"| node_streamcontrols
node_dashboard -->|"renders"| node_console
node_ingestui -.->|"shows preview stream"| node_platforms
node_app -->|"reads status"| node_statushook
node_app -->|"reads destinations"| node_desthook
node_app -->|"reads logs"| node_loghook
node_settingsui -.->|"updates settings"| node_config
node_destinationui -.->|"edits destinations"| node_destmanager
node_streamcontrols -.->|"controls streaming"| node_ffmpeg
node_theme -.->|"loads and saves theme"| node_config

click node_ingest "https://github.com/l33tdawg/freestream/blob/main/src/main/nms.ts"
click node_ffmpeg "https://github.com/l33tdawg/freestream/blob/main/src/main/ffmpeg-manager.ts"
click node_ffmpegdetect "https://github.com/l33tdawg/freestream/blob/main/src/main/ffmpeg-detector.ts"
click node_monitor "https://github.com/l33tdawg/freestream/blob/main/src/main/stream-monitor.ts"
click node_main "https://github.com/l33tdawg/freestream/blob/main/src/main/index.ts"
click node_ipc "https://github.com/l33tdawg/freestream/blob/main/src/main/ipc-handlers.ts"
click node_preload "https://github.com/l33tdawg/freestream/blob/main/src/main/preload.ts"
click node_destmanager "https://github.com/l33tdawg/freestream/blob/main/src/main/destination-manager.ts"
click node_config "https://github.com/l33tdawg/freestream/blob/main/src/main/config.ts"
click node_presets "https://github.com/l33tdawg/freestream/blob/main/src/main/constants.ts"
click node_keys "https://github.com/l33tdawg/freestream/blob/main/src/main/secrets.ts"
click node_shared "https://github.com/l33tdawg/freestream/blob/main/src/shared/types.ts"
click node_app "https://github.com/l33tdawg/freestream/blob/main/src/renderer/App.tsx"
click node_dashboard "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/Dashboard.tsx"
click node_destinationui "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/DestinationCard.tsx"
click node_settingsui "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/SettingsDialog.tsx"
click node_ingestui "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/IngestStatus.tsx"
click node_streamcontrols "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/StreamControls.tsx"
click node_console "https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/ConsolePanel.tsx"
click node_statushook "https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useStreamStatus.ts"
click node_desthook "https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useDestinations.ts"
click node_loghook "https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useAppLogs.ts"
click node_theme "https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useTheme.tsx"

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_main,node_ipc,node_preload,node_shared toneBlue
class node_ingest,node_ffmpeg,node_ffmpegdetect,node_monitor toneAmber
class node_app,node_dashboard,node_destinationui,node_settingsui,node_ingestui,node_streamcontrols,node_console,node_statushook,node_desthook,node_loghook,node_theme toneMint
class node_destmanager,node_config,node_presets,node_keys toneRose
class node_streamer,node_platforms toneIndigo
```

## Components

### Desktop orchestration

- [Electron services](https://github.com/l33tdawg/freestream/blob/main/src/main/index.ts): `src/main/index.ts`
- [IPC handlers](https://github.com/l33tdawg/freestream/blob/main/src/main/ipc-handlers.ts): `src/main/ipc-handlers.ts`
- [Preload bridge](https://github.com/l33tdawg/freestream/blob/main/src/main/preload.ts): `src/main/preload.ts`
- [Shared contracts](https://github.com/l33tdawg/freestream/blob/main/src/shared/types.ts): `src/shared/types.ts`

### Stream processing

- [RTMP ingest](https://github.com/l33tdawg/freestream/blob/main/src/main/nms.ts): `src/main/nms.ts`
- [FFmpeg fan-out](https://github.com/l33tdawg/freestream/blob/main/src/main/ffmpeg-manager.ts): `src/main/ffmpeg-manager.ts`
- [FFmpeg detection](https://github.com/l33tdawg/freestream/blob/main/src/main/ffmpeg-detector.ts): `src/main/ffmpeg-detector.ts`
- [Stream monitoring](https://github.com/l33tdawg/freestream/blob/main/src/main/stream-monitor.ts): `src/main/stream-monitor.ts`

### Dashboard interface

- [Application shell](https://github.com/l33tdawg/freestream/blob/main/src/renderer/App.tsx): `src/renderer/App.tsx`
- [Streaming dashboard](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/Dashboard.tsx): `src/renderer/components/Dashboard.tsx`
- [Destination cards and dialogs](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/DestinationCard.tsx): `src/renderer/components/DestinationCard.tsx`
- [Settings interface](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/SettingsDialog.tsx): `src/renderer/components/SettingsDialog.tsx`
- [Ingest status and preview](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/IngestStatus.tsx): `src/renderer/components/IngestStatus.tsx`
- [Stream controls](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/StreamControls.tsx): `src/renderer/components/StreamControls.tsx`
- [Log console](https://github.com/l33tdawg/freestream/blob/main/src/renderer/components/ConsolePanel.tsx): `src/renderer/components/ConsolePanel.tsx`
- [Stream status hook](https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useStreamStatus.ts): `src/renderer/hooks/useStreamStatus.ts`
- [Destinations hook](https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useDestinations.ts): `src/renderer/hooks/useDestinations.ts`
- [App logs hook](https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useAppLogs.ts): `src/renderer/hooks/useAppLogs.ts`
- [Theme provider](https://github.com/l33tdawg/freestream/blob/main/src/renderer/hooks/useTheme.tsx): `src/renderer/hooks/useTheme.tsx`

### Configuration and state

- [Destination management](https://github.com/l33tdawg/freestream/blob/main/src/main/destination-manager.ts): `src/main/destination-manager.ts`
- [Settings and destinations](https://github.com/l33tdawg/freestream/blob/main/src/main/config.ts): `src/main/config.ts`
- [Platform presets](https://github.com/l33tdawg/freestream/blob/main/src/main/constants.ts): `src/main/constants.ts`
- [Stream key storage](https://github.com/l33tdawg/freestream/blob/main/src/main/secrets.ts): `src/main/secrets.ts`

### Other components

- **OBS / Streamlabs**
- **Streaming platforms**

## Connections

- OBS / Streamlabs → RTMP ingest: publishes RTMP (evidence: `README.md`)
- RTMP ingest → FFmpeg fan-out: provides stream input (evidence: `README.md`)
- FFmpeg fan-out → Streaming platforms: fans out streams (evidence: `README.md`)
- Electron services → RTMP ingest: starts (evidence: `src/main/index.ts`)
- Electron services → FFmpeg fan-out: initializes (evidence: `src/main/index.ts`)
- Electron services → Destination management: creates (evidence: `src/main/index.ts`)
- Electron services → Stream monitoring: creates (evidence: `src/main/index.ts`)
- Electron services → IPC handlers: registers (evidence: `src/main/index.ts`)
- FFmpeg fan-out → Settings and destinations: reads settings (evidence: `src/main/ffmpeg-manager.ts`)
- FFmpeg fan-out → FFmpeg detection: detects encoders (evidence: `src/main/ffmpeg-manager.ts`)
- FFmpeg fan-out → Stream key storage: reads stream key (evidence: `src/main/ffmpeg-manager.ts`)
- FFmpeg fan-out → Streaming platforms: sends outputs (evidence: `README.md`)
- Destination management → Settings and destinations: reads and writes (evidence: `src/main/destination-manager.ts`)
- Destination management → Platform presets: uses platform defaults (evidence: `src/main/destination-manager.ts`)
- Destination management → Stream key storage: deletes key (evidence: `src/main/destination-manager.ts`)
- IPC handlers → Destination management: handles destination actions (evidence: `src/main/ipc-handlers.ts`)
- IPC handlers → FFmpeg fan-out: starts and stops (evidence: `src/main/ipc-handlers.ts`)
- IPC handlers → Stream monitoring: forwards status (evidence: `src/main/ipc-handlers.ts`)
- IPC handlers → Settings and destinations: handles settings (evidence: `src/main/ipc-handlers.ts`)
- IPC handlers → Stream key storage: handles key actions (evidence: `src/main/ipc-handlers.ts`)
- Application shell → Streaming dashboard: renders (evidence: `src/renderer/App.tsx`)
- Application shell → Settings interface: renders (evidence: `src/renderer/App.tsx`)
- Streaming dashboard → Destination cards and dialogs: renders (evidence: `src/renderer/components/Dashboard.tsx`)
- Streaming dashboard → Ingest status and preview: renders (evidence: `src/renderer/components/Dashboard.tsx`)
- Streaming dashboard → Stream controls: renders (evidence: `src/renderer/components/Dashboard.tsx`)
- Streaming dashboard → Log console: renders (evidence: `src/renderer/components/Dashboard.tsx`)
- Ingest status and preview → Streaming platforms: shows preview stream
- Application shell → Stream status hook: reads status (evidence: `src/renderer/App.tsx`)
- Application shell → Destinations hook: reads destinations (evidence: `src/renderer/App.tsx`)
- Application shell → App logs hook: reads logs (evidence: `src/renderer/App.tsx`)
- Settings interface → Settings and destinations: updates settings
- Destination cards and dialogs → Destination management: edits destinations
- Stream controls → FFmpeg fan-out: controls streaming
- Theme provider → Settings and destinations: loads and saves theme
