# alkaidlab/foundation-sunshine architecture

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

- Interactive diagram: https://gitdiagram.com/alkaidlab/foundation-sunshine
- Repository: https://github.com/alkaidlab/foundation-sunshine

## Overview

Foundation Sunshine is a remote-control and game-streaming host used with Moonlight clients. The principal workflow is a client connecting to the host, launching or viewing an application, and receiving low-latency video, audio, and input handling. The product also provides a web control interface and desktop panel, HDR and display management, collaboration features, native DualSense support, and optional telemetry. Relationships are limited to README-documented capabilities and connections visible in sampled source; several runtime integrations are not shown in the excerpts.

Main entry points: [`src/main.cpp`](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/main.cpp) (Sunshine Host), [`src/confighttp/routes.cpp`](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/confighttp/routes.cpp) (Web Interface), [`src/launch_session_manager.cpp`](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/launch_session_manager.cpp) (Session Launch), [`gamebar-widget/src/App.xaml.cs`](https://github.com/alkaidlab/foundation-sunshine/blob/master/gamebar-widget/src/App.xaml.cs) (Desktop Widget)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Streaming Sessions"]
  node_host["Sunshine Host<br/>[main.cpp]"]
  node_session_launch["Session Launch"]
  node_rtsp["RTSP Service<br/>[rtsp.cpp]"]
  node_stream["Stream Pipeline<br/>[stream.cpp]"]
end

subgraph group_management["Host Management"]
  node_web_ui["Web Interface<br/>[routes.cpp]"]
  node_app_library["Application Library<br/>[apps.cpp]"]
  node_config["Host Configuration<br/>[config.cpp]"]
  node_gamebar["Desktop Widget<br/>[App.xaml.cs]"]
end

subgraph group_media["Media and Devices"]
  node_display_hdr["Display and HDR<br/>[session.cpp]"]
  node_video_encode["Capture and Encoding<br/>[common.h]"]
  node_audio["Audio and Microphone<br/>[audio.cpp]"]
  node_input["Input Devices<br/>[input.cpp]"]
  node_dualsense["DualSense Support"]
end

subgraph group_collaboration["Collaboration"]
  node_clipboard["Clipboard Sharing"]
  node_file_sharing["File Sharing<br/>[service.cpp]"]
  node_usb_forward["USB Forwarding"]
end

subgraph group_operations["Host Operations"]
  node_telemetry["Telemetry Service<br/>[service.cpp]"]
  node_http_server["HTTP Server<br/>[server.cpp]"]
end

node_moonlight(("Moonlight Client"))

node_moonlight -->|"connects to"| node_host
node_host -.->|"starts sessions"| node_session_launch
node_session_launch -->|"uses RTSP"| node_rtsp
node_moonlight -->|"receives stream"| node_stream
node_moonlight -->|"sends controls"| node_input
node_moonlight -->|"manages host"| node_web_ui
node_web_ui -->|"registers routes"| node_http_server
node_web_ui -->|"manages apps"| node_app_library
node_gamebar -->|"manages host"| node_host
node_moonlight -->|"uses HDR"| node_display_hdr
node_moonlight -->|"receives video"| node_video_encode
node_moonlight -->|"uses audio"| node_audio
node_moonlight -->|"uses feedback"| node_dualsense
node_moonlight -->|"shares clipboard"| node_clipboard
node_moonlight -->|"shares files"| node_file_sharing
node_moonlight -->|"forwards USB"| node_usb_forward
node_host -.->|"reports telemetry"| node_telemetry

click node_host "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/main.cpp"
click node_session_launch "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/launch_session_manager.cpp"
click node_rtsp "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/rtsp.cpp"
click node_stream "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/stream.cpp"
click node_web_ui "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/confighttp/routes.cpp"
click node_app_library "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/confighttp/apps.cpp"
click node_config "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/config.cpp"
click node_gamebar "https://github.com/alkaidlab/foundation-sunshine/blob/master/gamebar-widget/src/App.xaml.cs"
click node_display_hdr "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/display_device/session.cpp"
click node_video_encode "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/platform/common.h"
click node_audio "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/audio.cpp"
click node_input "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/input.cpp"
click node_dualsense "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/platform/windows/ds5/ds5_native_client.cpp"
click node_clipboard "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/clipboard_bridge.cpp"
click node_file_sharing "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/file_mapping/service.cpp"
click node_usb_forward "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/remote_usb/remote_usb_host_controller.cpp"
click node_telemetry "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/telemetry/service.cpp"
click node_http_server "https://github.com/alkaidlab/foundation-sunshine/blob/master/src/http/server.cpp"

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_host,node_session_launch,node_rtsp,node_stream,node_moonlight toneBlue
class node_web_ui,node_app_library,node_config,node_gamebar toneAmber
class node_display_hdr,node_video_encode,node_audio,node_input,node_dualsense toneMint
class node_clipboard,node_file_sharing,node_usb_forward toneRose
class node_telemetry,node_http_server toneIndigo
```

## Components

### Streaming Sessions

- [Sunshine Host](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/main.cpp): `src/main.cpp`
- [Session Launch](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/launch_session_manager.cpp): `src/launch_session_manager.cpp`
- [RTSP Service](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/rtsp.cpp): `src/rtsp.cpp`
- [Stream Pipeline](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/stream.cpp): `src/stream.cpp`

### Host Management

- [Web Interface](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/confighttp/routes.cpp): `src/confighttp/routes.cpp`
- [Application Library](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/confighttp/apps.cpp): `src/confighttp/apps.cpp`
- [Host Configuration](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/config.cpp): `src/config.cpp`
- [Desktop Widget](https://github.com/alkaidlab/foundation-sunshine/blob/master/gamebar-widget/src/App.xaml.cs): `gamebar-widget/src/App.xaml.cs`

### Media and Devices

- [Display and HDR](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/display_device/session.cpp): `src/display_device/session.cpp`
- [Capture and Encoding](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/platform/common.h): `src/platform/common.h`
- [Audio and Microphone](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/audio.cpp): `src/audio.cpp`
- [Input Devices](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/input.cpp): `src/input.cpp`
- [DualSense Support](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/platform/windows/ds5/ds5_native_client.cpp): `src/platform/windows/ds5/ds5_native_client.cpp`

### Collaboration

- [Clipboard Sharing](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/clipboard_bridge.cpp): `src/clipboard_bridge.cpp`
- [File Sharing](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/file_mapping/service.cpp): `src/file_mapping/service.cpp`
- [USB Forwarding](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/remote_usb/remote_usb_host_controller.cpp): `src/remote_usb/remote_usb_host_controller.cpp`

### Host Operations

- [Telemetry Service](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/telemetry/service.cpp): `src/telemetry/service.cpp`
- [HTTP Server](https://github.com/alkaidlab/foundation-sunshine/blob/master/src/http/server.cpp): `src/http/server.cpp`

### Other components

- **Moonlight Client**

## Connections

- Moonlight Client → Sunshine Host: connects to (evidence: `README.md`)
- Sunshine Host → Session Launch: starts sessions
- Session Launch → RTSP Service: uses RTSP (evidence: `src/launch_session_manager.cpp`)
- Moonlight Client → Stream Pipeline: receives stream (evidence: `README.md`)
- Moonlight Client → Input Devices: sends controls (evidence: `README.md`)
- Moonlight Client → Web Interface: manages host (evidence: `README.md`)
- Web Interface → HTTP Server: registers routes (evidence: `src/confighttp/routes.cpp`)
- Web Interface → Application Library: manages apps (evidence: `src/confighttp/routes.cpp`)
- Desktop Widget → Sunshine Host: manages host (evidence: `README.md`)
- Moonlight Client → Display and HDR: uses HDR (evidence: `README.md`)
- Moonlight Client → Capture and Encoding: receives video (evidence: `README.md`)
- Moonlight Client → Audio and Microphone: uses audio (evidence: `README.md`)
- Moonlight Client → DualSense Support: uses feedback (evidence: `README.md`)
- Moonlight Client → Clipboard Sharing: shares clipboard (evidence: `README.md`)
- Moonlight Client → File Sharing: shares files (evidence: `README.md`)
- Moonlight Client → USB Forwarding: forwards USB (evidence: `README.md`)
- Sunshine Host → Telemetry Service: reports telemetry
