Architecture Overview - LeGeRyChEeSe/Sunshine-AIO GitHub Wiki

Architecture Overview

Technical overview of Sunshine-AIO's system design and component architecture.

🏗️ System Architecture

High-Level Design

Sunshine-AIO is a Python-based automation tool that orchestrates the installation and configuration of multiple streaming components:

graph TB
    User[User] --> Script[PowerShell Installer]
    Script --> Python[Python Environment]
    Python --> Core[Sunshine-AIO Core]
    
    Core --> Sunshine[Sunshine Server]
    Core --> VDD[Virtual Display Driver]
    Core --> SVM[Sunshine Virtual Monitor]
    Core --> Playnite[Playnite + Watcher]
    
    Sunshine --> Client[Moonlight Clients]
    VDD --> Display[Virtual Displays]
    SVM --> Scripts[PowerShell Scripts]
    Playnite --> Games[Game Libraries]

Installation Flow

sequenceDiagram
    participant U as User
    participant PS as PowerShell Script
    participant P as Python
    participant C as Components
    
    U->>PS: Execute installation command
    PS->>PS: Install Python/Git if needed
    PS->>P: Create virtual environment
    P->>P: Download Sunshine-AIO
    P->>U: Present component menu
    U->>P: Select components
    P->>C: Install selected components
    C->>U: Configuration complete

🔧 Core Components

1. Installation Automation

  • PowerShell Web Script: Entry point from sunshine-aio.com
  • Python Environment: Isolated virtual environment for dependencies
  • Component Installers: Automated downloaders and installers
  • Configuration Managers: Setup and configuration automation

2. Sunshine Streaming Server

  • Official Sunshine: Main streaming server application
  • Windows Service: Background service for continuous operation
  • Web Interface: Configuration UI at https://localhost:47990
  • Application Management: Game and app launching system

3. Virtual Display System

  • IDD Sample Driver: Microsoft's virtual display driver
  • VDD Control: Tool for driver management
  • Display Profiles: Custom resolution and HDR configurations
  • Multi-monitor Support: Multiple virtual displays

4. Game Library Integration

  • Playnite: Universal game library manager
  • Platform Support: Steam, Epic, GOG, Xbox Game Pass, etc.
  • Fullscreen Mode: Controller-optimized interface
  • Playnite Watcher: Streaming integration enhancements

📁 Project Structure

Sunshine-AIO/
├── src/                          # Python source code
│   ├── main.py                   # Main entry point
│   ├── misc/                     # Core modules
│   │   ├── Config.py             # Download and installation
│   │   ├── SystemRequests.py     # System operations
│   │   ├── MenuHandler.py        # User interface
│   │   └── variables/            # Configuration data
│   └── tools/                    # Downloaded components
├── requirements.txt              # Python dependencies
├── install.ps1                   # Local PowerShell installer
└── README.md                     # Documentation

🔄 Component Integration

Installation Tracking

Sunshine-AIO maintains detailed records of all installed components:

  • Installation paths and metadata
  • Registry entries and services created
  • Files and directories added
  • Rollback information for clean uninstall

Configuration Management

  • Sunshine: Automatic service configuration and firewall setup
  • VDD: Driver installation and virtual display creation
  • Playnite: Fullscreen mode optimization for streaming
  • Integration: Cross-component configuration coordination

🌐 Network Architecture

Local Network Streaming

Host PC (Sunshine-AIO)          Client Device (Moonlight)
├── Sunshine Service            ├── Moonlight Client
├── Port 47989 (Stream)    ←────├── Stream Reception
├── Port 47990 (Web UI)         ├── Input Capture
└── Virtual Display             └── Audio/Video Output

Internet Streaming (Optional)

  • Port Forwarding: Router configuration for external access
  • Dynamic DNS: Domain mapping for remote connections
  • Authentication: Secure access with certificates and passwords
  • Encryption: HTTPS/TLS for all communications

🛡️ Security Design

Installation Security

  • Verified Downloads: Official sources with integrity checking
  • Administrator Privileges: Required only for system components
  • Isolated Environment: Python virtual environment isolation
  • Clean Uninstall: Complete removal tracking

Runtime Security

  • Service Security: Sunshine runs as Windows service
  • Network Security: Encrypted communications by default
  • Access Control: Authentication for remote connections
  • Certificate Management: Automatic SSL certificate generation

🚀 Performance Considerations

Streaming Optimization

  • Hardware Encoding: Automatic GPU encoder detection (NVENC/AMF)
  • Network Adaptation: Bitrate adjustment based on connection
  • Low Latency: Optimized capture and encoding pipeline
  • Multi-client Support: Virtual display separation

System Efficiency

  • Minimal Footprint: Python virtual environment isolation
  • Background Operation: Windows service for always-on streaming
  • Resource Management: Automatic cleanup and optimization
  • Update System: Incremental updates without full reinstall

🔮 Technology Stack

Core Technologies

  • Python 3.8+: Main automation language
  • PowerShell: Windows integration and scripting
  • Sunshine: C++ streaming server (NVIDIA GameStream protocol)
  • Moonlight: Client applications (various platforms)

Supporting Components

  • IDD Sample Driver: Microsoft virtual display driver
  • Playnite: C# game library manager
  • Multi Monitor Tool: Display management utility
  • Various PowerShell Scripts: Display automation

📊 Data Flow

Installation Process

  1. Web Script Download: PowerShell downloads from sunshine-aio.com
  2. Environment Setup: Python and Git installation if needed
  3. Repository Clone: Latest Sunshine-AIO from GitHub
  4. Component Selection: User chooses installation components
  5. Automated Installation: Each component installer runs
  6. Configuration: Automatic setup and optimization
  7. Verification: Test installations and create shortcuts

Streaming Operation

  1. Service Start: Sunshine service begins on Windows boot
  2. Client Connection: Moonlight discovers and connects to host
  3. Authentication: Certificate and password verification
  4. Display Capture: Virtual or physical display streaming
  5. Encoding: Hardware-accelerated video compression
  6. Network Transmission: Encrypted stream to client
  7. Input Relay: Client input sent back to host

🔧 Extensibility

Adding New Components

The architecture supports easy addition of new streaming components:

  1. Component Class: Implement standard installer interface
  2. Menu Integration: Add to component selection menu
  3. Configuration: Define setup and optimization parameters
  4. Testing: Verify integration with existing components

Future Enhancements

  • Cloud Integration: Remote configuration and monitoring
  • Plugin System: Community-contributed components
  • Advanced Analytics: Performance monitoring and optimization

For implementation details, see the source code at GitHub