MusivaDocs

System Architecture & Ecosystem

Comprehensive architectural overview showing the data flows, service boundaries, and responsibility assignments across the Musiva platform.

Musiva decouples the client interaction layer, core business logic, audio processing nodes, and external metadata providers into discrete, highly specialized components.


High-Level Architecture Diagram

The flowchart below visualizes how requests move from user interfaces down through the backend orchestration layer, auxiliary token microservices, the Lavalink Gateway, and finally to the underlying audio streaming nodes:

Rendering diagram...

Service Responsibility Matrix

Each component in the Musiva ecosystem has a strictly bounded set of responsibilities:

ComponentEndpointPrimary Responsibility
TopCharthttps://topchart.musiva.app/Scrapes and serves official Spotify Top Track Daily and Top Country charts for dashboard widgets.
Deezer ARLhttps://deezer.musiva.app/Automated account authentication, session validation, token rotation, and providing valid ARLs for lossless playback.
Spotify Tokenerhttps://spotify.musiva.app/Custom token endpoint facilitating Spotify Partner API access for Lavalink track metadata resolution.
POT TokenInternal / PlannedPlanned additional YouTube bot-detection mitigation token (Status: Planned).
Lavalink Gatewayhttps://lava.musiva.app/Unified connection proxy, health monitoring, dynamic load balancing, zero-downtime node failover, and monetization.
Musiva BackendInternal EngineCore business logic, Discord interaction handler, REST/WebSocket API, WebPlayer synchronization, and user session management.

Architectural Advantages

1. Separation of Responsibilities

Instead of maintaining authentication code, ARL parsers, and chart scraping routines inside the bot repository, each capability runs as an autonomous service with its own release cycle and error boundaries.

2. High-Performance Audio Routing

Lavalink nodes are dedicated purely to audio extraction, transcoding, and UDP streaming to Discord voice servers. They are decoupled from the bot's Node.js runtime, ensuring zero event-loop blocking during heavy playback workloads.

3. Masked Infrastructure & Fault Tolerance

Discord bots connect exclusively to the Lavalink Gateway hostname (gateway.musiva.app). The actual hardware nodes (IP addresses, physical ports, geographical regions) remain confidential. Nodes can be taken down for OS upgrades or kernel reboot without modifying client application code.

4. Hybrid Monetization

The Gateway architecture serves dual roles: powering Musiva's official bots internally while simultaneously providing managed Lavalink hosting for external third-party Discord bot developers via Patreon tiers.