📖 Complete Tutorial

The following sections provide detailed step-by-step instructions with code examples.

💾 1) Database Setup with Supabase

🎯 YOUR ROLE: You'll manually set up the Supabase database by pasting SQL code into their editor. This is a one-time setup that creates the foundation for storing votes.

Step 1: Create Supabase Project

✋ YOU DO THIS:

  1. Go to and create an account (if needed)

    com

  2. Click "New Project"

  3. Choose a name, password, and region

  4. IMPORTANT: Copy and save your Project URL and anon/public key (found in Settings → API)

Step 2: Create Database Tables

✋ YOU DO THIS:

  1. In your Supabase dashboard, click "SQL Editor" in the left sidebar
  2. Click "New Query"
  3. Paste the SQL code below
  4. Click "Run" (or press Ctrl+Enter)

SQL CODE TO PASTE:

-- Create items table
CREATE TABLE items (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
label text NOT NULL,
description text,
likes_count integer DEFAULT 0
);
-- Create likes table
CREATE TABLE likes (
id serial PRIMARY KEY,
item_id uuid REFERENCES items(id) ON DELETE CASCADE,
session_id text NOT NULL,
created_at timestamp with time zone DEFAULT now()
);

Step 3: Set Up Security Policies

✋ YOU DO THIS: