How 8xff/atm0s-media-server works
Main Components
• Core Server (Node): This is the heart of the system. Look at the “bin” folder which contains the main executable (main.rs) as well as code for HTTP API endpoints for console, media, metrics, nodes, tokens, connector, gateway, etc. This component is responsible for handling incoming control messages, media processing, cluster management, and coordination.
• Media Core Libraries: Under packages/media_core and supporting libraries (packages/media_utils, packages/media_record, etc.) you see the domain logic for clustering, room management, media track processing, audio mixing, and messaging. Represent this as the “Media Core” block.
• Transport/Protocol Layers: The project includes specific packages for protocols and transports: e.g., packages/protocol, transport_rtpengine, transport_webrtc. These are responsible for media and signalling transport using WebRTC, QUIC, Whep, Whip, etc. Create separate blocks for “Transport – WebRTC,” “Transport – RTP/RTPEngine,” and “Protocol Handler.”
• External Interfaces: There is a dedicated “Media Console Front” (under packages/media_console_front) which provides a user interface (React-based) that interacts with the backend via HTTP APIs. Also, there are clearly defined API endpoints (located in bin/src/http) for various operations.
• Decentralized Cluster Components: The system is built for a decentralized architecture with multiple zones. Include a “Cluster & Multi-Zone” component that reflects the roles of the “gateway,” “connector,” and “node” components (found in bin/src/server & docs/contributor-guide/servers).
• Additional Supporting Packages: There are extra packages for multi-tenancy, secure communication (media_secure), and media codecs. These should be indicated as part of the supporting libraries in the overall architecture.
Relationships and Interactions
• The Core Server nodes interact with the Media Core libraries to coordinate clustering, media processing, and state management.
• The API layer (HTTP endpoints in bin/src/http) serves as an entry point for both the internal controls and external connections (e.g., from the Media Console Front).
• The Media Console Front communicates with the API server to present the current system state, configure settings, and monitor performance.
• The “Cluster & Multi-Zone” component indicates that several nodes (each with their gateway, connector, and media binaries) exchange data and coordinate in a peer-to-peer manner.
Architectural Patterns & Design Principles
• Modularization: The separation between the “bin” (executables) and “packages” (libraries/services) shows a highly modular design, allowing independent evolution of components.
• Decentralization: Emphasize that there is no central controller; every node is capable of handling media streams and cluster management.
• Separation of Concerns: Distinct directories are responsible for API endpoints, cluster communication, media processing, and transport handling.
• Extensibility: The layered design (with protocols, core, transport, and a front end) makes it straightforward to add new transports or change core logic.
• Use of Modern Technologies: Built in Rust for performance and safety; the React-based front end and Docker/Kubernetes deployment scripts emphasize a modern, cloud-friendly architecture.
Technologies and Frameworks
• Rust (for all backend/logical components).
• React (in the Media Console Front).
• Docker and Kubernetes (for deployment, referenced in installation docs).
• Protocols such as WebRTC, Whip, and Whep are central to media transport.
• Various libraries for SQL storage and migration indicating use of a lightweight persistence layer where needed.
• Continuous integration with GitHub Actions, as seen in the .github/workflows.
Additional Detail
• If space allows, represent the cluster concept with multiple nodes interconnected. Indicate that each node contains similar components (HTTP API, server core, transport handling, etc.).