What is Sunshine?
Sunshine offers low-latency, cloud gaming server capabilities with support for AMD, Intel, and Nvidia GPUs for hardware encoding. Software encoding is also available. You can connect to Sunshine from any Moonlight client on a variety of devices. A web UI is provided to allow configuration and client pairing from your favorite web browser.Technology Stack
Core Technologies
Backend- Language: C++ (requires C++17 or later)
- Build System: CMake (>= 3.25)
- Compilers: GCC 13+, Clang 17+, or Apple Clang 15+
- Key Libraries:
- Boost (filesystem, locale, log)
- OpenSSL (cryptography)
- FFmpeg (video/audio encoding)
- libopus (audio codec)
- miniupnpc (UPnP support)
- Framework: Vue.js 3
- Build Tool: Vite
- Templating: EJS
- Styling: Bootstrap 5
- Icons: Lucide and Simple Icons
- Linux: VAAPI, KMS/DRM, X11, Wayland, CUDA (optional)
- Windows: DirectX, DXGI, Windows.Graphics.Capture, NVENC
- macOS: Video Toolbox, AVFoundation
- FreeBSD: Wayland, X11
Project Structure
The Sunshine repository is organized as follows:Key Components
Understanding the main components will help you navigate the codebase:Core Systems
- main.cpp (
src/main.cpp:1): Application entry point, initialization, and command-line handling - config.cpp (
src/config.cpp:1): Configuration parsing and management - process.cpp (
src/process.cpp:1): Application lifecycle and process management
Streaming Pipeline
- nvhttp.cpp (
src/nvhttp.cpp:1): NVIDIA GameStream-compatible HTTP server - rtsp.cpp (
src/rtsp.cpp:1): RTSP session management - stream.cpp (
src/stream.cpp:1): Main streaming logic and session handling - video.cpp (
src/video.cpp:1): Video capture and encoding - audio.cpp (
src/audio.cpp:1): Audio capture and streaming
Platform Abstraction
- platform/common.h (
src/platform/common.h:1): Platform interface definitions - platform/linux/ (
src/platform/linux/): Linux implementations (X11, Wayland, KMS, CUDA) - platform/windows/ (
src/platform/windows/): Windows implementations (DXGI, WGC) - platform/macos/ (
src/platform/macos/): macOS implementations (Video Toolbox)
Web UI
- confighttp.cpp (
src/confighttp.cpp:1): REST API backend for web interface - src_assets/common/assets/web/: Vue.js frontend application
Getting Started with Development
1. Clone the Repository
--recurse-submodules flag is important as Sunshine uses several git submodules for third-party dependencies.
2. Install Dependencies
Dependencies vary by platform. See the Building from Source guide for detailed platform-specific instructions.3. Build the Project
4. Run Tests
If built withBUILD_TESTS=ON (default):
5. Run the Application
Development Workflow
Code Style
Sunshine usesclang-format for code formatting. The configuration is in .clang-format at the repository root.
Format your code before committing:
Web UI Development
The Web UI can be developed independently: Using CMake:Debugging
Build in Debug mode for better debugging symbols:- CLion: Full-featured C++ IDE from JetBrains
- Visual Studio Code: With C++ and CMake extensions
- Visual Studio: On Windows with CMake support
Documentation
Sunshine uses Doxygen for API documentation. Build docs with:build/docs/html/.
Community and Support
For development questions and discussions:- GitHub Issues: Report bugs and request features
- GitHub Discussions: Ask questions and share ideas
- Discord: Join the LizardByte community server
- Documentation: Official docs
Next Steps
Building from Source
Learn how to build Sunshine on your platform
Architecture
Understand the system architecture and design
Contributing
Learn how to contribute code and documentation
GitHub Repository
View the source code on GitHub

