Skip to content

dx: add a Supabase seed script so contributors get a populated dashboard out of the box #71

Closed

Description

@gkhngyk

Why

Right now, after a fresh supabase db reset, the dashboard is empty. To see anything beyond the empty-state screens, a contributor has to:

  1. Sign up locally
  2. Create a brand, topics, prompts
  3. Configure provider API keys (ANTHROPIC_API_KEY for the direct-API path, CLORO_API_KEY for the scraper-backed answer engines) — the scraper is a paid third-party service
  4. Run a tracking job and wait for webhooks

That's a lot of friction for someone whose actual goal is a UI tweak. The result is that contributors hit empty pages, can't tell what their change does, and either give up or rely on us to hand-hold them past it. (See #38 for a recent example where a contributor working on a UI feature got stuck here.)

What we want

A supabase/seed.sql that runs automatically on supabase db reset and populates the local database with realistic-but-clearly-fake demo data — enough to drive every UI surface in the dashboard.

After running supabase db reset, the contributor should be able to:

  • Sign in as a known demo user (e.g. [email protected] / demo123)
  • Land on a dashboard already wired to a demo brand
  • See populated Insights, Citations, Competitors, Content Opportunities, and AI Traffic pages
  • Apply filters (date range, platform, model, region, topic) and watch the data react

What to seed

A deterministic, single-organization fixture is enough. Suggested shape:

  • 1 organization (Demo Org, plan self_hosted)
  • 1 auth user + profile ([email protected], password demo123, role owner)
  • 1 brand (something obviously fake like Acme Coffee or Demo Brand — please don't use a real company name)
  • 2 topics under the brand (e.g. Coffee subscription services, Espresso machines under $500)
  • 6–10 prompts spread across the topics
  • ~80–120 prompt_results rows that cover the platforms / models / regions we actually track.

Platforms and models

The value that ends up in prompt_results.platform is the id field of a scraper in SCRAPER_GROUPS in web/src/config/prompt-options.ts, plus claude for the direct-API row. The accompanying model_used value varies: ChatGPT and Grok return a model identifier; most other scraper-backed engines echo the platform name back. Use this set as a starting point — read the file when you write the seed in case it has evolved:

platform typical model_used values
chatgpt-web gpt-5-5, gpt-5-3-mini
claude claude-sonnet-4-6
copilot-web copilot-web
gemini-web gemini-web
google-aimode google-aimode
google-aio google-aio
grok-web grok-3
perplexity-web perplexity-web

For the seed, ChatGPT rows should split across both gpt-5-5 and gpt-5-3-mini so the model filter has something to discriminate on within the same platform.

Regions

A mix of region values drawn from REGIONS in web/src/config/prompt-options.ts — uppercase ISO-3166 codes (US, GB, DE, FR, TR, …). Pick four or five so the region filter is meaningful.

Other columns

  • created_at spread over the last 30 days so the time-series charts have a curve to draw
  • Realistic mention_count, citation_count, visibility_score, sentiment (mix of positive / neutral / negative)
  • citations JSONB with 2–5 plausible URLs each (use example.com, wikipedia.org, reddit.com — nothing real)
  • competitor_mentions JSONB referencing a small set of fake competitor names

Supporting rows

  • 3–5 competitors for the brand
  • 2–3 content_opportunities
  • A few ai_traffic_logs rows (so that page isn't empty either)

Use fixed UUIDs throughout ('00000000-0000-0000-0000-000000000001' style) so the seed is idempotent — running supabase db reset twice should produce the same database, not duplicates.

Source of truth: the catalog of platforms, models, and regions lives in web/src/config/prompt-options.ts. The table above is a snapshot. Read the file when you write the seed so you stay in sync — and if anything in the table looks stale by the time you pick this up, trust the code, not the issue body.

Where it goes

Constraints

  • No real customer / brand names anywhere. Use obvious placeholders (Acme, Demo, Fixture).
  • Idempotent. Use INSERT … ON CONFLICT DO NOTHING or fixed UUIDs so re-running is safe.
  • Self-contained. No dependency on cloud-only env, Stripe, scraper providers, or LLM keys. The seed should populate everything the UI needs to render.
  • Local-only. The supabase/seed.sql convention already restricts this to supabase db reset — nothing here should be runnable against a production database.

How to verify

  • Fresh checkout, run supabase db reset — completes without errors
  • pnpm dev (web + server), open http://localhost:3000, sign in with the demo credentials
  • Dashboard renders with a brand, topics, prompts visible
  • Insights page shows charts with data points spread over the last 30 days
  • Citations page lists rows with URLs
  • Competitors page shows the seeded competitors
  • Content Opportunities page shows the seeded opportunities
  • AI Traffic page shows traffic rows
  • Platform / model / region / topic filters all return non-empty subsets
  • Run supabase db reset a second time — no duplicate rows, no errors
  • No real-world brand / company name appears in any of the seed data

Out of scope

Contribution guide

See CONTRIBUTING.md for branch naming, commit conventions, and PR workflow.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on May 21, 2026
  2. self-assigned this
    on May 21, 2026
  3. added a commit that references this issue on May 22, 2026
    01fc1fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions