Projects

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
Radio Ibnul Qoyyim Tuner in its dark theme: an Arabic lecture title over its series artwork, with LIVE and AUTO source toggle and a large listen button
The Tuner between live broadcasts, switching automatically between LIVE and the Auto station.

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

  1. A synchronized Auto station with no playout server

    Every client computes the current track and offset via (now − epoch) % totalDuration from a fixed epoch anchor, keeping all listeners in sync without streaming infrastructure.

  2. Debugging Cloudflare Realtime SFU DataChannels

    Standard WebRTC ondatachannel failed 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.

  3. 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.

  4. 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.

    Riq Tuner library on a phone: lecture series with recording counts and offline download buttons
    Library on mobile: series browsing and offline downloads.

Architecture

From the studio to listeners

  1. StudioOperator publishes live audio to Cloudflare Realtime SFU.
  2. Durable ObjectHolds live broadcast state and counts WebSocket listeners.
  3. Realtime SFUFans out live audio and the metadata DataChannel.
  4. TunerPlays live audio, the computed Auto loop, or Library tracks.
  5. LibraryServes R2 recordings via CDN with offline downloads.

Decisions

  • Cloudflare Realtime SFU
  • Cloudflare Workers / Durable Objects / D1 / R2
  • Realtime presence
  • Audio playback & Media Session
  • Web components
  • Release automation
  • Architecture decision records