Not connected
Enter your Supabase credentials. Find them under Settings → API. Stored only in your browser.

Settings → API → Project URL

Settings → API → anon / public key


Run once in Supabase → SQL Editor
-- Drop old tables if upgrading
drop table if exists votes;
drop table if exists polls;

-- Polls table
create table polls (
  id         uuid primary key default gen_random_uuid(),
  title      text not null,
  questions  jsonb not null,
  created_at timestamptz default now()
);

-- Votes table
create table votes (
  id             uuid primary key default gen_random_uuid(),
  poll_id        uuid references polls(id) on delete cascade,
  voter_email    text not null,
  question_index int  not null,
  option_index   int  not null,
  created_at     timestamptz default now()
);

alter table polls enable row level security;
alter table votes enable row level security;

create policy "public read polls"   on polls for select using (true);
create policy "public insert polls" on polls for insert with check (true);
create policy "public read votes"   on votes for select using (true);
create policy "public insert votes" on votes for insert with check (true);