SYS_ARCHITECTURE
Architecture
How KhelaDekho works under the hood — the streaming pipeline from source aggregation to decryption to playback.
The Pipeline
data_flow
Client Request→HMAC Validation→Cloudflare Edge Proxy→AES-GCM Decryption→HLS/DASH Playback
Layer 01
Frontend UI (Next.js)
The presentation layer is built with Next.js 14 and Tailwind CSS. It focuses on a premium, glassmorphic aesthetic while dynamically rendering live sports channels. All API requests to the proxy backend are authenticated securely.
system.out
$
// Client-side stream fetching
const response = await fetch('/api/v1/channels/wctveng/stream', {
headers: {
'X-Signature-Token': hmacToken,
'X-Signature-Timestamp': timestamp
}
});Layer 02
FastAPI Gateway
The Python FastAPI backend acts as a highly concurrent gateway. It validates cryptographic signatures, manages Redis caching for frequently accessed streams, and utilizes HTTPX connection pooling for fast proxy resolution.
Key Features
- ▸Connection Pooling — Async connections are pooled and maintained for minimal latency.
- ▸Redis Caching — Stream manifests and decrypted keys are cached to reduce upstream load.
- ▸Strict Rate Limiting — Prevents abuse using sliding window IP-based tracking.
Layer 03
Edge Proxy & Decryption
KhelaDekho uses Cloudflare Workers to proxy streaming segments directly from source CDNs. The backend performs AES-GCM (A256GCM) decryption to extract ClearKey DRM parameters.