riq
Live radio and on-demand lecture library for Ma'had Ibnul Qoyyim, streaming from a browser Studio via Cloudflare Realtime SFU to web, Android, and embedded players.
- Status
- On Google Play
- Platform
- PWA · Android · web embed
- Built with
- TypeScript · Hono · SvelteKit
- Realtime
- Cloudflare Realtime SFU
- Decision records
- 8 ADRs
- Gate
- Android tuner release workflow
- Harness
- Claude · Cursor · Antigravity CLI
- Interface
- Indonesian

Overview
Teachers broadcast live from a browser Studio while listeners tune in via the Tuner (PWA, Android app, or site embed). Off-air, listeners get a synchronized Auto station and an offline-downloadable lecture Library.
Built entirely on Cloudflare: Hono Worker, Realtime SFU for live audio and metadata, Durable Object for presence, and D1/R2 for the archive— documented across eight ADRs.
Stack
Backend
- Hono on Cloudflare Workers
- Public and operator APIs plus static hosting for Tuner, Studio, and embed.
- Durable Object
- Tracks live broadcast state and WebSocket listener presence.
- D1 + R2
- Catalog in D1; public audio served from R2 with edge caching and range requests.
Clients
- SvelteKit monorepo
- Tuner and Studio share audio, WebRTC, playback, ID3, and UI packages.
- Capacitor (Android)
- Bundles the Tuner for reliable background audio with CI Play publishing.
- Web component embed
- Drop-in live/Auto player for WordPress and external sites.
- Firebase Cloud Messaging
- Opt-in push notifications when a broadcast goes live.
Engineering highlights
A synchronized Auto station with no playout server
Every client computes the current track and offset via
(now − epoch) % totalDurationfrom a fixed epoch anchor, keeping all listeners in sync without streaming infrastructure.Debugging Cloudflare Realtime SFU DataChannels
Standard WebRTC
ondatachannelfailed silently on the SFU. After testing production behavior, metadata channels are published by name, bound by SCTP stream ID after renegotiation, and attached only after audio starts so metadata never delays playback.Exact listener presence via Durable Objects
Replacing KV heartbeats (write-limited and eventually consistent) with silent WebSockets to a Durable Object gives instant listener counts, relayed by the Studio over the metadata DataChannel.
One Tuner build, three surfaces
PWA, Android app, and web embed share identical playback logic. The Android app bundles assets locally and publishes its versioned Play listing from CI.

Library on mobile: series browsing and offline downloads.
Architecture
From the studio to listeners
- StudioOperator publishes live audio to Cloudflare Realtime SFU.
- Durable ObjectHolds live broadcast state and counts WebSocket listeners.
- Realtime SFUFans out live audio and the metadata DataChannel.
- TunerPlays live audio, the computed Auto loop, or Library tracks.
- LibraryServes R2 recordings via CDN with offline downloads.
More screens
