# realtime

This Claude Code rule sets the pattern for Supabase Realtime subscriptions. It directs component code to useRealtimeSubscription instead of calling supabase.channel() directly.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 1120 repo stars
- Author: rerun-build
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/realtime.mdc
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/realtime

## What it does

The rule tells components to subscribe to Supabase Realtime changes through `useRealtimeSubscription` from `@/hooks/useRealtimeSubscription.ts`. Direct calls to `supabase.channel()` in components are disallowed.

The hook takes a table name and subscription options. These can enable or disable the subscription, filter rows by a column, and handle insert, update, or delete events. The update callback receives both the new and previous records. The project needs the referenced hook file.

## Requirements
- Works with: Supabase

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/realtime.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/realtime.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/realtime.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/realtime.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/realtime.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/rerun-build/rerun/tree/HEAD/apps/ui/.cursor/rules/realtime.mdc

## When to use it
- subscribe to Supabase table changes through a shared hook
- filter subscription events by a column value
- handle inserted, updated, or deleted records

## Example prompts
- Route `orders` table changes through `useRealtimeSubscription`.
- Handle update and delete events for this table with the shared hook.

## Similar
- [supabase-realtime-optimizer](https://affpapa.org/en/nevibecode/agents/supabase-realtime-optimizer.md) — subagent · 1346 installs
- [supabase-audit-realtime](https://affpapa.org/en/nevibecode/skills/supabase-audit-realtime.md) — skill · 566 installs
- [convex-realtime](https://affpapa.org/en/nevibecode/skills/convex-realtime.md) — skill · 2900 installs
- [supabase-development](https://affpapa.org/en/nevibecode/skills/supabase-development.md) — skill · 740 installs
- [supabase-skills](https://affpapa.org/en/nevibecode/plugins/supabase-skills.md) — plugin · ★ 1216 repo stars
- [inngest-realtime](https://affpapa.org/en/nevibecode/skills/inngest-realtime.md) — skill · 881 installs

From the same set: [rerun-build/rerun](https://affpapa.org/en/nevibecode/by/rerun-build/rerun.md) — 25 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
