How acelikesghosts/ytm-rpc works
Core Components
• Browser Extension (Chrome/Firefox)
• Server Component
• Discord Client Integration
• Client Modifications (BetterDiscord/Replugged)
Connection Flows
• Browser Extension → Server (Song data)
• Server → Discord (RPC/WebSocket)
• Server → Client Mods (WebSocket when USING_WS is true)
• Blue: Browser components
• Green: Server components
• Purple: Discord components
• Orange: Data flow paths
Detailed Component Breakdown
Server (packages/server):
┌─ Server Component ─────────────┐
• RPCServer │
• WSServer │
• Song Management │
• ┘
Extension (packages/extension):
┌─ Browser Extension ────────────┐
• Content Script │
• Popup Interface │
• Polyfill │
• ┘
Client Mods:
┌─ Discord Integration ──────────┐
• Native RPC │
• BetterDiscord Plugin │
• Replugged Plugin │
• ┘
Additional Elements
• Connection types (WebSocket/RPC)
• State indicators (Playing/Paused)
• Data flow directions
• Component responsibilities
Technical Details to Note
Annotations for:
• Port configurations
• Environment variables
• Supported browsers
• Required Node.js version (v18.17.1 LTS)
Implementation Notes
• The modular package structure
• The separation between native RPC and client mod approaches
• The central role of the server component
• The extension's content script interaction with Youtube Music