Architecture Overview
Sireno Deck is built with a client-server architecture using WebSocket communication.
System Components
Section titled “System Components”┌─────────────────────────────────────────────────────────────┐│ Sireno Deck CLI │├─────────────────────────────────────────────────────────────┤│ Config Loader │ Addon Loader │ Theme Loader │├─────────────────────────────────────────────────────────────┤│ Runtime Engine ││ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ Deck Manager │ │ Action Exec │ │ State Pub/Sub│ ││ └──────────────┘ └──────────────┘ └──────────────┘ │├─────────────────────────────────────────────────────────────┤│ Output Client (Real Device / Emulator) │├─────────────────────────────────────────────────────────────┤│ WS Bridge │ HTTP Server (Frontend) │└─────────────────────────────────────────────────────────────┘ │ WebSocket / HTTP │ ▼┌─────────────────────────────────────────────────────────────┐│ Frontend (React) ││ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ Deck View │ │ Button Render│ │ Theme System │ ││ └──────────────┘ └──────────────┘ └──────────────┘ │└─────────────────────────────────────────────────────────────┘Core Systems
Section titled “Core Systems”Config Loading
Section titled “Config Loading”- Discover config file (multiple paths)
- Parse YAML
- Expand includes
- Validate with Zod schema
- Load addons
- Build runtime decks
Deck Management
Section titled “Deck Management”- Main deck: Primary deck at startup
- Sub-decks: Navigated via
core:change-deck - Overlay decks: Auto-show based on active app
- Paginated decks: Split across multiple pages
Action Execution
Section titled “Action Execution”- User gesture on button
- Runtime receives
button-actionmessage - Look up button type and config
- Execute action (shell command, key macro, etc.)
- Publish state updates
State Management
Section titled “State Management”- Pub/Sub: Channel-based state distribution
- Polling: Periodic data collection (system-status, media, etc.)
- Caching: Last-known values for new subscribers
Output Clients
Section titled “Output Clients”Real Device
Section titled “Real Device”- Stream Deck SDK communication
- HID protocol
Emulator
Section titled “Emulator”- Virtual device in browser
- Same WebSocket protocol as real device
Data Flows
Section titled “Data Flows”Button Press
Section titled “Button Press”Frontend Button Click → Gesture Detection (tap/dbl-tap/hold) → WS Message: { type: "button-action", gesture, position } → Runtime.invokeAction() → Execute action (runCommand/keyMacro/etc.) → State Publisher broadcasts updates → Frontend receives state update → Button re-rendersTheme Loading
Section titled “Theme Loading”Config → Theme Entry → Theme Loader discovers manifest → CSS Generator creates theme CSS → Virtual Module provides tokens to frontend → React Context provides theme valuesAddon Loading
Section titled “Addon Loading”Config → Addon Entry → Addon Loader discovers sirenodeck.json → Registry validates manifest → Load frontend components → Register backend services → Connect to runtimeKey Files
Section titled “Key Files”| Component | Path |
|---|---|
| Config loading | src/config/loader.ts |
| Runtime engine | src/deck/runtime.ts |
| Methods API | src/deck/methods.ts |
| WS Bridge | src/render/ws-bridge.ts |
| Pub/Sub | src/core/pub-sub.ts |
| Addon loader | src/addon/loader.ts |
| Theme loader | src/themes/loader.ts |