How-to: Run a Local Supabase with Seed Data
When you’re tuning the ranking algorithm, nothing beats having a local Supabase that behaves exactly like production. Here’s how we boot ours in under 20 minutes.
Goal
Spin up Supabase locally, apply the HUD schema, and seed a demo user + sources so the HUD shows real content without touching production rows.
Steps
- Start Supabase (Docker required). This creates local Postgres + auth services.
supabase start
- Apply migrations. We lean on the CLI to reset and apply everything in
supabase/migrations/0001_init.sql.
supabase db reset --use-migra --password postgres
# or, if you just want to apply once
supabase db query < supabase/migrations/0001_init.sql
- Seed a demo user and an RSS source. Run the SQL below via
supabase db queryor the SQL editor.
insert into auth.users (id, email)
values ('00000000-0000-4000-8000-000000000001', 'dev@example.com')
on conflict do nothing;
insert into public.profiles (id, email, display_name)
values ('00000000-0000-4000-8000-000000000001', 'dev@example.com', 'Dev User')
on conflict (id) do nothing;
insert into public.sources (user_id, type, url, display_name)
values ('00000000-0000-4000-8000-000000000001', 'rss', 'https://hnrss.org/frontpage', 'Hacker News')
on conflict do nothing;
- Point the app at local Supabase by adjusting
web/.env.local.
NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=anon-key
NEXT_PUBLIC_SUPABASE_ANON_KEY=anon-key
SUPABASE_SERVICE_ROLE_KEY=service-role-key
SUPABASE_PROJECT_REF=local-dev
- Run the app and kick ingestion.
cd web && npm run dev
curl -X POST http://localhost:3000/api/cron/rss
Visit /hud and you’ll see Hacker News headlines flow in, proving the edge function path works locally.
Pitfalls
- Keep Docker running—
supabase startdepends on it. - Local keys (
anon-key,service-role-key) are safe for dev only. Don’t reuse them in staging.
Time estimate
15–20 minutes, including a coffee refill.