How elyseemb/controllerobs works
Project type and purpose
• ControllerOBS is a full-stack Node.js/TypeScript application.
• Purpose: provide a modern React-based UI to drive OBS Studio via the obs-websocket API. It bundles a backend server that:
• Serves the React SPA (Vite build)
• Manages WebSocket/HTTP endpoints (Socket.IO, finalhandler, serve-static)
• Connects to OBS Studio (OBS-Websocket-JS)
• Manages profiles and configuration (JSON files via utils/db.ts)
File structure
• Top-level:
• src/main → server code (app.ts, modules, clients, ObsServer, utils)
• src/render → client code (React/Vite, Layout, components, views, assets)
• src/resources/json/config.json → persisted settings/profiles
• build → compiled output (server and client)
• Patterns & modules:
• MVC-style breakdown inside server: Controller.ts ▲ business logic, Server.ts ▲ HTTP/WebSocket setup, Clients → OBS client wrapper, modules/Profiles & Setup → domain modules
• Reactive flows (RxJS) inside modules/Controller.ts
• Serve static client and open WebSocket channel via Socket.IO
• Configuration/build: package.json scripts, nodemon.json, tsconfig.json, Vite config
README
• Confirms: full-stack Node+TS, React/Vite front end + Node server back end
• Key tech: OBS-Websocket-JS, Socket.IO, finalhandler, serve-static, RxJS, pnpm
Main components and interactions
a. Components
• Frontend (Browser/React SPA)
• Backend HTTP/WebSocket Server (Express-style + Socket.IO)
• OBS WebSocket API (external service running in OBS Studio)
• Configuration store (local JSON DB)
• Logger (utils/logger.ts)
b. Relationships & data flows
1. User interacts with React UI → emits Socket.IO events or HTTP fetch to Server
2. Server’s ObsServer/Controller modules process the request → use OBSClient to call the OBS WebSocket API
3. OBS Studio responds → OBSClient publishes events via RxJS streams → Controller pushes responses back to UI over Socket.IO
4. For profile/setup, Controller/Profiles modules read/write config.json via db.ts → notify UI of changes
c. Architectural patterns
• Layered: Presentation (React) → API (Socket.IO/HTTP) → Domain logic (Controller, Profiles, Setup modules) → External integration (OBSClient) → Data store (JSON)
• Reactive streams (RxJS) inside the domain layer
• Modular: each feature (Profiles, Setup, Controller) is its own module
d. Key frameworks/technologies
• Frontend: React, Vite, TypeScript, CSS modules
• Server: Node.js, TypeScript, RxJS, Socket.IO, finalhandler, serve-static
• External: obs-websocket-js