AgentStack
SKILL verified MIT Self-run

Realtime Subscriptions

skill-m-binimran-dev-pack-realtime-subscriptions · by m-binimran

Add Supabase Realtime to a Next.js app — Postgres Changes, Broadcast, and Presence — with proper cleanup and RLS-aware channels. Use when building live updates, presence indicators, or collaborative features.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-m-binimran-dev-pack-realtime-subscriptions

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Realtime Subscriptions? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

realtime-subscriptions

Live data is a client concern (it needs a persistent connection). Wire it carefully and always clean up.

Pick the mechanism

| Need | Use | |------|-----| | React to DB inserts/updates/deletes | Postgres Changes | | Ephemeral messages (cursors, typing) | Broadcast | | Who's online / shared state | Presence |

Process

  1. Subscribe in a client component, inside useEffect. Realtime can't live in a server component.
  2. Always unsubscribe in the effect cleanup (supabase.removeChannel(channel)) — leaked channels pile up

and cause duplicate handlers.

  1. RLS applies to Realtime. A client only receives change events for rows it's allowed to read. Enable

Realtime on the table and confirm the policies.

  1. Reconcile with your cache: on an event, update the query cache (state-architect) rather than keeping a

parallel copy. Handle reconnects (refetch on SUBSCRIBED after a drop).

  1. Don't over-subscribe: scope channels narrowly (filter by id); a firehose channel is a performance and

cost problem.

Output

  • The channel setup, the cleanup, the RLS/Realtime enablement note, and how events update the UI/cache.

Guardrails

  • Every subscription has a matching cleanup — no exceptions (memory + duplicate-event bugs).
  • Realtime is not your security layer; RLS is. Don't broadcast data the user can't already read.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.