Supabase Real-Time

Live database integration

Connecting to Supabase...

Setup Required

To activate real-time features, complete these steps in your Supabase dashboard:

  1. 1
    Add your Supabase credentials — set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY in your .env file.
  2. 2
    Create the messages table — run this SQL in the Supabase SQL Editor:
    CREATE TABLE messages (
      id BIGSERIAL PRIMARY KEY,
      content TEXT NOT NULL,
      username TEXT NOT NULL,
      created_at TIMESTAMPTZ DEFAULT NOW()
    );
    
    -- Enable Row Level Security
    ALTER TABLE messages ENABLE ROW LEVEL SECURITY;
    
    -- Allow all reads
    CREATE POLICY "Allow reads" ON messages
      FOR SELECT USING (true);
    
    -- Allow all inserts
    CREATE POLICY "Allow inserts" ON messages
      FOR INSERT WITH CHECK (true);
    
    -- Allow all deletes
    CREATE POLICY "Allow deletes" ON messages
      FOR DELETE USING (true);
  3. 3
    Enable Replication — in Supabase go to Database → Replication and enable the messages table.

Real-Time Updates

Messages appear instantly via Supabase Realtime subscriptions — no polling needed.

PostgreSQL Backend

Data is persisted in a fully managed PostgreSQL database with Row Level Security.

Secure by Default

Row Level Security policies control data access at the database level.