-- Create a key-value state table for this frontend app. -- Run this in Supabase SQL Editor. create table if not exists public.app_state ( state_key text primary key, payload jsonb not null default '{}'::jsonb, updated_at timestamptz not null default now() ); alter table public.app_state enable row level security; -- Allow authenticated and anonymous clients with anon key to read/write app state. -- For production hardening, replace these policies with stricter rules. drop policy if exists "app_state_read_all" on public.app_state; create policy "app_state_read_all" on public.app_state for select using (true); drop policy if exists "app_state_insert_all" on public.app_state; create policy "app_state_insert_all" on public.app_state for insert with check (true); drop policy if exists "app_state_update_all" on public.app_state; create policy "app_state_update_all" on public.app_state for update using (true) with check (true);