Skip to content

Document the live data layer and the realtime contract - #25

Merged
HomemadeToast57 merged 1 commit into
mainfrom
jack/realtime-docs
Jul 28, 2026
Merged

Document the live data layer and the realtime contract#25
HomemadeToast57 merged 1 commit into
mainfrom
jack/realtime-docs

Conversation

@HomemadeToast57

Copy link
Copy Markdown
Collaborator

The README described the previous realtime design — a row-data-free {table, op} ping on a public channel, with "refetch on each ping" as the app pattern. That channel no longer exists, and that pattern is specifically what made rows pop in and out.

Replaced with:

  • useEntity — what callers actually use, with the mutation surface
  • What's underneath — row-bearing broadcasts on private channels joined with a short-TTL gateway-minted token, one hop, no refetch
  • The clarification everyone needs: "private" means token-gated, not login-gated. A public app with no accounts gets a token for every visitor.
  • Failure behavior — retry + report, never silent degradation; data still loads over HTTP
  • Live data notes — keep the ./lib/supabase bootstrap import, render data directly (don't mirror it into useState), don't add your own optimistic layer, and batch high-frequency input (a drawing app writing per pointermove is ~60 requests/second)
  • postgres_changes doesn't work on gateway-era apps — stated explicitly

AGENTS.md gains a realtime section pointing at the platform repo's architecture doc plus the four traps that are easy to reintroduce.

Docs only — no code change.

The README still described the previous design — a row-data-free ping on a
public channel with "refetch on each ping" — which is both gone and, as app
guidance, the pattern that made rows pop in and out. Replaces it with what
callers actually use (useEntity), what happens underneath (row-bearing private
channels, gateway-minted tokens), and the notes that prevent the mistakes real
apps hit: keep the bootstrap import, render the hook's data directly, don't
layer your own optimistic state, and batch high-frequency input instead of
writing per input event.

Clarifies the term that misleads everyone: "private" means token-gated, not
login-gated. A public app with no accounts gets a token for every visitor.

AGENTS.md gains a realtime section pointing at the platform repo's architecture
doc, plus the four traps that are easy to walk back into.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@HomemadeToast57
HomemadeToast57 merged commit 0dadd04 into main Jul 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant