Overview
Discover what makes Sunshine powerful
Sunshine is a lightweight, self‑hosted game streaming server that implements the **P2P streaming protocol** used by NVIDIA’s GameStream. It exposes a single TCP/UDP port and negotiates with Moonlight clients (Android, iOS, Windows, macOS, Linux, Xbox, etc.) to deliver a low‑latency, full‑resolution video feed of the host machine’s desktop. From a developer standpoint, Sunshine is essentially an *edge device* that bridges raw GPU frames to a WebRTC‑style transport, while also providing an HTTP/JSON API for discovery and configuration.
Language & Runtime
Encoding & GPU Access
Networking
Web UI
Overview
Sunshine is a lightweight, self‑hosted game streaming server that implements the P2P streaming protocol used by NVIDIA’s GameStream. It exposes a single TCP/UDP port and negotiates with Moonlight clients (Android, iOS, Windows, macOS, Linux, Xbox, etc.) to deliver a low‑latency, full‑resolution video feed of the host machine’s desktop. From a developer standpoint, Sunshine is essentially an edge device that bridges raw GPU frames to a WebRTC‑style transport, while also providing an HTTP/JSON API for discovery and configuration.
Technical Stack
- Language & Runtime: The core is written in Rust, chosen for its zero‑cost abstractions, safety guarantees, and native support for asynchronous I/O via the
tokioruntime. - Encoding & GPU Access: Hardware encoding is delegated to platform‑specific backends:
- Windows: DirectX Video Acceleration (DXVA) via the
dxva2crate. - Linux: VA‑API (AMD/Intel) or NVENC through the
nvenccrate. - macOS: VideoToolbox (Apple’s hardware encoder).
- Windows: DirectX Video Acceleration (DXVA) via the
- Networking: Implements the GameStream protocol over UDP, with optional TCP fallback for control channels. Uses
tokio::netfor non‑blocking sockets andserde_jsonfor the JSON control API. - Web UI: A minimal single‑page app served by
warp(Rust web framework). The UI communicates with the backend over a local WebSocket for real‑time status updates. - Database: No persistent database; configuration is stored in a simple
tomlfile and runtime state is kept in memory.
Core Capabilities
| Feature | Description |
|---|---|
| Device Discovery | Sunshine advertises itself via mDNS (Bonjour) and a local HTTP endpoint (/info) for Moonlight to query. |
| Pairing & Authentication | Uses a short‑lived pairing key (displayed on the UI) that Moonlight clients validate over HTTPS. |
| Encoding Options | Runtime flags allow selection between hardware encoders (NVENC, VA‑API, VideoToolbox) or software x264. |
| Input Emulation | Implements the GameStream input protocol to translate controller events (Xbox, PlayStation, Switch) into raw HID reports. |
| Dynamic Configuration | Exposes /config API to adjust bitrate, resolution, frame‑rate caps, and encoder presets on the fly. |
Deployment & Infrastructure
- Self‑Hosting: Sunshine runs as a single binary with no external dependencies beyond the GPU driver stack. It can be launched on bare‑metal PCs, Raspberry Pi 4 (with NVENC support), or any Docker host.
- Containerization: Official Docker images are available on Docker Hub, GHCR, and Flathub. The container exposes ports
47984(UDP) and47998/48010(TCP) and mounts a volume for the config file. - Scalability: Each Sunshine instance handles one client at a time due to the nature of GameStream. For multi‑player setups, developers can orchestrate multiple Sunshine instances behind a load balancer and use a custom session manager to route clients.
- Resource Utilization: Because encoding runs on the GPU, CPU usage is minimal. Memory footprint stays below 50 MiB for a typical game stream.
Integration & Extensibility
- Plugin Hooks: Sunshine exposes a simple plugin API via dynamic library loading (
.so/.dll). Plugins can intercept input events or modify encoder settings at runtime. - Webhooks: The HTTP API supports POST callbacks on pairing events, enabling integration with home‑automation systems (e.g., trigger a smart light when a stream starts).
- Custom UI: The front‑end is written in vanilla JS and can be forked; developers may replace it with a React or Vue wrapper if they need richer analytics dashboards.
- SDK: The Rust crate
sunshine-client(not yet published) provides a thin wrapper around the GameStream protocol, useful for building custom clients or bots.
Developer Experience
- Documentation: The GitHub repo contains a comprehensive README, API reference (JSON schemas), and example configuration snippets. The codebase follows Rust idioms, making it approachable for developers familiar with async patterns.
- Community: An active Discord channel and issue tracker allow rapid feedback. The project is open‑source under the MIT license, facilitating commercial use without licensing fees.
- Testing: Unit tests cover protocol parsing and configuration logic; integration tests use a headless Moonlight client to validate end‑to‑end streaming.
Use Cases
- Home Cloud Gaming – Run Sunshine on a high‑end PC to stream games to phones or smart TVs without paying for commercial services.
- Embedded Gaming Appliances – Deploy Sunshine on a Raspberry Pi 4 with an NVIDIA Jetson GPU to create low‑cost streaming boxes for retro gaming.
- Enterprise Training – Use Sunshine in a lab to provide instructors with remote, low‑latency access to simulation software on powerful workstations.
- IoT Edge Gaming – Combine Sunshine with a custom IoT controller to create “living room” kiosks that stream games on demand.
Advantages
- Zero Cost & Full Control – No subscription fees; all data stays on local hardware.
- Low Latency & High Fidelity – Hardware‑accelerated encoding and UDP transport deliver <30 ms latency on modern networks.
Open SourceReady to get started?
Join the community and start self-hosting Sunshine today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Explore More Apps
PsiTransfer
Self-hosted file sharing without accounts
Kubek
Minecraft server control panel for Linux & Windows
EGroupware
Open source online office for secure, sovereign collaboration
Courier MTA
All-in-one mail and groupware server
Bitwarden
Secure, open‑source password manager for individuals and teams
ClipBucket V5
Self-hosted video & photo sharing platform