Database
12 Nov 2026
10 min read

Database Seeding: Realistic Test Data for Local Development

Creating comprehensive seed scripts for Supabase to populate your local database with realistic test data.

Database Seeding for Local Development

SpaceZero ships no seed script. The only database artifact is the migration supabase/migrations/00001_spacezero_core.sql, which creates two tables: user_profiles and app_entitlements (plus RLS policies and the public avatars storage bucket). docs/seed.md is a product specification template, not a SQL seed file.

Test Users

There is no supabase auth sign-up command. Create test users in the Supabase Dashboard (Authentication → Users → Add user), or via the Admin API:

typescript

await supabase.auth.admin.createUser({

email: '[email protected]',

password: 'test-password-1',

email_confirm: true,

});

Optional: Add Your Own Seed

The Supabase CLI runs supabase/seed.sql automatically after supabase db reset if the file exists. To seed profiles and entitlements for your test users:

sql

-- supabase/seed.sql

-- Run with: supabase db reset (replays migrations + this file)

 

-- User profiles for test accounts

INSERT INTO user_profiles (id, email, full_name, avatar_url, newsletter_subscribed, created_at, updated_at)

SELECT

id, email, 'Test User ' || ROW_NUMBER() OVER (), null, false, NOW(), NOW()

FROM auth.users

WHERE email LIKE 'test%@example.com'

ON CONFLICT (id) DO UPDATE SET

full_name = EXCLUDED.full_name,

updated_at = NOW();

 

-- Entitlements (for Gumroad testing)

INSERT INTO app_entitlements (gumroad_sale_id, email, user_id, product_id, status, metadata, updated_at)

SELECT

'test_sale_' || ROW_NUMBER() OVER (),

email,

id,

'test_product',

'active',

'{}'::jsonb,

NOW()

FROM auth.users

WHERE email LIKE 'test%@example.com'

ON CONFLICT (gumroad_sale_id) DO NOTHING;

Running Migrations

bash

# Replay all migrations (and supabase/seed.sql if present)

supabase db reset

 

# Or apply migrations without the seed

supabase migration up

Environment-Specific Seeds

For larger datasets, generate SQL with a script (Faker.js or plain TypeScript) and commit the output as supabase/seed.sql. Keep production seeds minimal — reference data only.

CI Integration

yaml

# .github/workflows/test.yml

- name: Setup Supabase

uses: supabase/setup-cli@v1

 

- name: Start Supabase

run: supabase start

 

- name: Run Migrations

run: supabase db reset

 

- name: Run Tests

run: npm test

Benefits

  • Consistent State: Every developer has the same test data
  • Fast Onboarding: New devs productive immediately
  • Realistic Testing: Data mirrors production patterns
  • CI Ready: Automated test database setup