Build a Realtime Change Feed

Problem Implement a change feed: clients subscribe to a table (with an optional filter) and receive insert/update/delete events as rows change, backed by Postgres logical replication (Supabase Realtime).

Requirements

  • subscribe(table, filter) returns a stream of change events for matching rows.
  • Deliver inserts, updates, and deletes; fan out only the changes a subscription matches.

Areas to design

  • Sourcing changes from the database (logical replication / WAL) rather than polling.
  • Matching each change against active subscriptions and filters efficiently.
  • Back-pressure and slow consumers; ordering and at-least-once vs exactly-once delivery.

Example

  • subscribe("orders", status='paid') → a stream emitting only paid-order changes.
added …
LeaderboardSalaryAccount