We will use REST for standard operations and WebSockets/WebRTC for real-time social interactions and telemetry.
POST /api/v1/content/uploadHeaders: Authorization: Bearer <JWT>, Idempotency-Key: <UUID>GET /api/v1/content/{video_id}/manifestResponse: Returns the DASH/HLS manifest URL optimized for the client's device and region.POST /api/v1/social/rooms/{room_id}/joinHeaders: Authorization: Bearer <JWT>```mermaid
flowchart TD
classDef client fill:#E3F2FD,stroke:#1565C0,stroke-width:2px,color:#000;
classDef edge fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px,color:#000;
classDef gateway fill:#FFF3E0,stroke:#EF6C00,stroke-width:2px,color:#000;
classDef service fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px,color:#000;
classDef storage fill:#FFEBEE,stroke:#C62828,stroke-width:2px,color:#000;
Directional Arrows
C -->|1.RequestStream| CDN
CDN -->|2.CacheMiss| AG
C -->|3.Upload/Social| AG
AG -->|4.RouteUpload| US
AG -->|5.RouteMetadata| MS
US -->|6.SaveRaw| Obj
US -->|7.QueueJob| Tr
Tr -->|8.SaveChunks| Obj
Tr -->|9.UpdateMeta| DB
MS -->|10.FetchMeta| Redis
Redis -->|11.CacheMiss| DB
Obj -->|12.Distribute| CDN
```
Idempotency-Key (a UUID generated by the client). The API Gateway checks Redis for this key. If it exists, it returns the cached successful response immediately without hitting the backend. If not, it processes the request and stores the response against the key.motion_to_photon_latency_ms, buffer_starvation_count, transcoding_queue_depth, and cdn_cache_hit_ratio. Alerts are triggered on P99 latency spikes.