How-to guides

Listen to database changes in realtime

Realtime pushes database changes to every open screen, so lists, dashboards and chats stay current without polling.

Subscribe

realtime.ts
const channel = supabase
  .channel('todos-changes')
  .on('postgres_changes',
    { event: '*', schema: 'public', table: 'todos' },
    (payload) => console.log(payload.eventType, payload.new))
  .subscribe()

Filter

realtime.ts
  .on('postgres_changes',
    { event: 'INSERT', schema: 'public', table: 'messages', filter: 'room_id=eq.42' },
    onMessage)

Clean up

realtime.ts
supabase.removeChannel(channel)

Security

Realtime respects the same access rules as your API, so users only receive changes to rows they’re allowed to read.

Questions

Do I need to enable anything?

Realtime is part of every project; subscribe from the client with supabase-js.

Updated 2026-10-23.