How zlingapp/server works
Main Components
a) Client Interface Layer:
• HTTP Server (actix-web)
• WebSocket Server (actix-ws)
• SSL/TLS termination point (when enabled)
b) Authentication & Authorization:
• Token Management System
• Access Token Handler
• Refresh Token Storage
c) Core Services:
• User Management
• Guild (Server) Management
• Channel Management
• Friend System
• Messaging System
• Voice Chat System (WebRTC/mediasoup)
• Media Storage
• Real-time Event System
d) Data Storage:
• PostgreSQL Database
• File Storage System
Component Relationships
[Clients] → [HTTP/WebSocket Layer]
• ↓
[Authentication Layer] → [Token Management]
• ↓
• [Core Services Layer]
• ↙ ↓ ↓ ↘
• [Voice] [Messages] [Media] [Users/Guilds]
• ↘ ↓ ↓ ↙
• [Database & Storage Layer]
Specific Implementation Details
a) HTTP/WebSocket Layer:
• Actix-web handling HTTP requests
• WebSocket connections for real-time events
• SSL/TLS termination point if enabled
b) Voice System:
• Mediasoup SFU components
• WebRTC ports (10000-10003)
• UDP/TCP transport options
c) Database Layer:
• PostgreSQL with connection pool
• Migration system
• Separate media storage system
Important Flows to Highlight
a) Authentication Flow:
Client → Login Request → Token Issuing → Access/Refresh Tokens
b) Real-time Communication:
Client → WebSocket → PubSub System → Event Distribution
c) Voice Chat Flow:
Client → WebRTC Negotiation → mediasoup → Peer Distribution
Additional Elements
• Scaling points (NUM_WEB_WORKERS)
• Security boundaries
• Public/private network boundaries
Technical Details to Note
• Database migrations system
• Token signing mechanism
• Media file storage path
• WebRTC ports and configurations
• Connection pooling
• Nested components
• Clear labeling
• Proper grouping of related components
• Component boundaries
• Configuration points
• Scaling indicators
This will create a comprehensive yet understandable representation of Zling's architecture that highlights its key features and components while maintaining technical accuracy.