# ilyap358/fluxcast architecture

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

- Interactive diagram: https://gitdiagram.com/ilyap358/fluxcast
- Repository: https://github.com/ilyap358/fluxcast

## Overview

FluxCast is a Linux desktop-to-TV streaming application. Its primary workflow selects a monitor and Wi-Fi Direct peer, negotiates a Miracast/WFD session, captures and encodes desktop media, then sends it to the TV over RTP. DLNA and Cast are separate fallback/experimental routes. The README documents these product paths; sampled source confirms parts of WFD media, RTSP, capture, tray, and Cast behavior, so uncertain internal wiring is omitted.

Main entry points: [`src/main.py`](https://github.com/ilyap358/fluxcast/blob/main/src/main.py) (CLI orchestrator), [`src/wfd/session.py`](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/session.py) (WFD session), [`src/wfd/media/pipeline.py`](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/media/pipeline.py) (Media pipeline), [`src/server.py`](https://github.com/ilyap358/fluxcast/blob/main/src/server.py) (HTTP stream server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_main["CLI orchestrator<br/>[main.py]"]
  node_doctor["Diagnostics<br/>[diagnostics.py]"]
end

subgraph group_wfd["WFD streaming"]
  node_wfd_session["WFD session<br/>[session.py]"]
  node_p2p["Wi-Fi Direct"]
  node_nm["NetworkManager backend<br/>[nm.py]"]
  node_wpas["Supplicant backend<br/>[wpas.py]"]
  node_rtsp_server["RTSP server<br/>[rtsp_server.py]"]
  node_rtsp_handler["WFD negotiation<br/>[handler.py]"]
  node_media["Media pipeline<br/>[pipeline.py]"]
  node_media_backends["Capture backends"]
  node_uibc["Input backchannel<br/>[uibc.py]"]
end

subgraph group_alternatives["Other protocols"]
  node_dlna["DLNA sender<br/>[dlna.py]"]
  node_cast["Cast sender<br/>[cast.py]"]
  node_http_server["HTTP stream server<br/>[server.py]"]
end

subgraph group_interaction["Desktop interaction"]
  node_tray["System tray<br/>[tray.py]"]
  node_capture["Monitor capture<br/>[capture.py]"]
  node_portal_capture["Portal capture<br/>[portal_capture.py]"]
end

node_user(("Desktop user"))
node_wfd_tv(("WFD receiver"))
node_tv(("TV or receiver"))

node_user -->|"chooses mode"| node_main
node_user -->|"uses controls"| node_tray
node_tray -->|"launches mode"| node_main
node_main -->|"runs checks"| node_doctor
node_main -->|"starts WFD"| node_wfd_session
node_wfd_session -->|"selects monitor"| node_capture
node_wfd_session -->|"connects peer"| node_p2p
node_p2p -->|"uses backend"| node_nm
node_p2p -.->|"uses backend"| node_wpas
node_wfd_session -->|"starts session server"| node_rtsp_server
node_wfd_tv -->|"opens session"| node_rtsp_server
node_rtsp_server -->|"dispatches requests"| node_rtsp_handler
node_rtsp_handler -->|"starts media"| node_media
node_media -->|"uses capture backend"| node_media_backends
node_media -.->|"opens portal session"| node_portal_capture
node_rtsp_handler -.->|"starts input channel"| node_uibc
node_uibc -->|"injects local input"| node_user
node_main -->|"starts DLNA"| node_dlna
node_main -->|"starts Cast"| node_cast
node_main -->|"starts stream server"| node_http_server
node_dlna -->|"serves HTTP stream"| node_http_server
node_cast -->|"plays stream URL"| node_http_server
node_http_server -->|"streams media"| node_tv
node_media -->|"sends RTP media"| node_wfd_tv

click node_main "https://github.com/ilyap358/fluxcast/blob/main/src/main.py"
click node_doctor "https://github.com/ilyap358/fluxcast/blob/main/src/diagnostics.py"
click node_tray "https://github.com/ilyap358/fluxcast/blob/main/src/ui/tray.py"
click node_capture "https://github.com/ilyap358/fluxcast/blob/main/src/capture/capture.py"
click node_portal_capture "https://github.com/ilyap358/fluxcast/blob/main/src/capture/portal_capture.py"
click node_wfd_session "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/session.py"
click node_p2p "https://github.com/ilyap358/fluxcast/tree/main/src/wfd/p2p"
click node_nm "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/p2p/nm.py"
click node_wpas "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/p2p/wpas.py"
click node_rtsp_server "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/rtsp/rtsp_server.py"
click node_rtsp_handler "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/rtsp/handler.py"
click node_media "https://github.com/ilyap358/fluxcast/blob/main/src/wfd/media/pipeline.py"
click node_media_backends "https://github.com/ilyap358/fluxcast/tree/main/src/wfd/media"
click node_uibc "https://github.com/ilyap358/fluxcast/blob/main/src/drivers/uibc.py"
click node_dlna "https://github.com/ilyap358/fluxcast/blob/main/src/dlna/dlna.py"
click node_cast "https://github.com/ilyap358/fluxcast/blob/main/src/cast/cast.py"
click node_http_server "https://github.com/ilyap358/fluxcast/blob/main/src/server.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_main,node_doctor,node_user toneBlue
class node_wfd_session,node_p2p,node_nm,node_wpas,node_rtsp_server,node_rtsp_handler,node_media,node_media_backends,node_uibc toneAmber
class node_dlna,node_cast,node_http_server toneMint
class node_tray,node_capture,node_portal_capture toneRose
class node_wfd_tv,node_tv toneIndigo
```

## Components

### App entry

- [CLI orchestrator](https://github.com/ilyap358/fluxcast/blob/main/src/main.py): `src/main.py`
- [Diagnostics](https://github.com/ilyap358/fluxcast/blob/main/src/diagnostics.py): `src/diagnostics.py`

### WFD streaming

- [WFD session](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/session.py): `src/wfd/session.py`
- [Wi-Fi Direct](https://github.com/ilyap358/fluxcast/tree/main/src/wfd/p2p): `src/wfd/p2p`
- [NetworkManager backend](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/p2p/nm.py): `src/wfd/p2p/nm.py`
- [Supplicant backend](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/p2p/wpas.py): `src/wfd/p2p/wpas.py`
- [RTSP server](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/rtsp/rtsp_server.py): `src/wfd/rtsp/rtsp_server.py`
- [WFD negotiation](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/rtsp/handler.py): `src/wfd/rtsp/handler.py`
- [Media pipeline](https://github.com/ilyap358/fluxcast/blob/main/src/wfd/media/pipeline.py): `src/wfd/media/pipeline.py`
- [Capture backends](https://github.com/ilyap358/fluxcast/tree/main/src/wfd/media): `src/wfd/media`
- [Input backchannel](https://github.com/ilyap358/fluxcast/blob/main/src/drivers/uibc.py): `src/drivers/uibc.py`

### Other protocols

- [DLNA sender](https://github.com/ilyap358/fluxcast/blob/main/src/dlna/dlna.py): `src/dlna/dlna.py`
- [Cast sender](https://github.com/ilyap358/fluxcast/blob/main/src/cast/cast.py): `src/cast/cast.py`
- [HTTP stream server](https://github.com/ilyap358/fluxcast/blob/main/src/server.py): `src/server.py`

### Desktop interaction

- [System tray](https://github.com/ilyap358/fluxcast/blob/main/src/ui/tray.py): `src/ui/tray.py`
- [Monitor capture](https://github.com/ilyap358/fluxcast/blob/main/src/capture/capture.py): `src/capture/capture.py`
- [Portal capture](https://github.com/ilyap358/fluxcast/blob/main/src/capture/portal_capture.py): `src/capture/portal_capture.py`

### Other components

- **Desktop user**
- **WFD receiver**
- **TV or receiver**

## Connections

- Desktop user → CLI orchestrator: chooses mode
- Desktop user → System tray: uses controls
- System tray → CLI orchestrator: launches mode
- CLI orchestrator → Diagnostics: runs checks
- CLI orchestrator → WFD session: starts WFD
- WFD session → Monitor capture: selects monitor
- WFD session → Wi-Fi Direct: connects peer
- Wi-Fi Direct → NetworkManager backend: uses backend
- Wi-Fi Direct → Supplicant backend: uses backend
- WFD session → RTSP server: starts session server
- WFD receiver → RTSP server: opens session
- RTSP server → WFD negotiation: dispatches requests
- WFD negotiation → Media pipeline: starts media
- Media pipeline → Capture backends: uses capture backend
- Media pipeline → Portal capture: opens portal session
- WFD negotiation → Input backchannel: starts input channel
- Input backchannel → Desktop user: injects local input
- CLI orchestrator → DLNA sender: starts DLNA
- CLI orchestrator → Cast sender: starts Cast
- CLI orchestrator → HTTP stream server: starts stream server
- DLNA sender → HTTP stream server: serves HTTP stream
- Cast sender → HTTP stream server: plays stream URL
- HTTP stream server → TV or receiver: streams media
- Media pipeline → WFD receiver: sends RTP media
