Skip to content

feat(dx): Supabase seed.sql for a populated local dashboard - #75

Merged
gkhngyk merged 5 commits into
mainfrom
feat/supabase-seed-data
May 22, 2026
Merged

gkhngyk merged 5 commits into
mainfrom
feat/supabase-seed-data

Conversation

@gkhngyk

@gkhngyk gkhngyk commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds supabase/seed.sql — an idempotent demo fixture that gives contributors a fully populated local dashboard out of the box, plus the fixes needed for it to apply and render cleanly.

Closes #71

What's included

  • Demo fixture: one demo organization, brand, topics, six prompts, ~120 prompt results across all tracked engines, prompt search volumes, competitors, content opportunities (with detail-page source data), and AI traffic logs. Sign in with [email protected] / demo123.
  • Fixes for a clean apply + render:
    • Drop the generated email column from the auth.identities insert (was aborting the seed).
    • Seed auth.users token columns as empty strings — NULL aborted every login with a GoTrue scan error (converting NULL to string is unsupported).
    • Populate prompt_volumes so the Prompts page renders (these normally come from paid DataForSEO/AI analysis a contributor won't have keys for).
    • Use valid enum values for content opportunity status/type (previously rendered as raw i18n keys).
  • Docs: CONTRIBUTING.md and the self-host guide note the demo data, the demo sign-in, and that the Prompts/Content pages need the backend server running (they fetch through the API, not Supabase directly).

Safety

  • Touches only supabase/seed.sql + docs — no web/ or server/ code changes.
  • The seed runs only against a local Supabase via the CLI (supabase db reset); hosted/production projects are never touched.
  • Fully idempotent (fixed UUIDs + ON CONFLICT DO NOTHING).

How to test

npx supabase db reset
# then start BOTH dev servers (web + server)

Sign in with [email protected] / demo123 and confirm the dashboard, Prompts, and Content pages are populated.

gkhngyk added 5 commits May 21, 2026 16:49
Closes #71.

Fresh `supabase db reset` now lands the contributor on a working
dashboard without provisioning provider API keys or running a tracking
job. The fixture seeds:

- A demo auth user ([email protected] / demo123) wired to a
  self_hosted org with subscription_status='active'
- One demo brand, two topics, six prompts spread across both topics
- ~127 prompt_results across all eight tracked engines, nine
  model_used values, and five regions, time-stamped across the last
  30 days so charts have a curve to draw
- Four competitors, three content opportunities, six AI traffic rows

Every row uses a fixed UUID and `ON CONFLICT DO NOTHING`, so
`supabase db reset` is idempotent — re-running produces the same DB,
not duplicates. The seed only flows through the CLI; hosted projects
are never touched.

Updates README.md and docs/self-host/supabase-setup.mdx with the demo
credentials.
auth.identities.email is GENERATED ALWAYS from identity_data->>'email';
inserting it explicitly aborts the seed with SQLSTATE 428C9. Removing the
column lets the seed apply cleanly on a fresh local stack.
GoTrue scans confirmation_token, recovery_token, email_change*, phone_change*
and reauthentication_token into Go strings; leaving them NULL aborts every
password login with "converting NULL to string is unsupported" (HTTP 500).
Seeding them as '' lets the demo user sign in on a fresh local stack.
- Add prompt_volumes rows for all six demo prompts (keyword search volumes,
  intents, AI-volume estimates) so the Prompts page renders fully once the
  backend serves them — contributors can't generate these without paid
  DataForSEO/AI keys.
- Enrich content_opportunities source_data with promptText, estAiVolume,
  visibilityScore, competitorGap, intent, keywords and competitorsCited so the
  opportunity detail page's Source Data panel is populated.
- Fix invalid enum values that rendered as raw i18n keys: status
  'reviewing' -> 'in_progress', type 'gap' -> 'owned'.
Note that supabase/seed.sql populates a local dashboard via 'supabase db
reset', the demo sign-in, and that the Prompts and Content pages need the
backend server running (they fetch through the API, not Supabase directly).
@mintlify

mintlify Bot commented May 22, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ansvisor 🟢 Ready View Preview May 22, 2026, 11:18 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@gkhngyk
gkhngyk merged commit 01fc1fc into main May 22, 2026
2 checks passed
@gkhngyk
gkhngyk deleted the feat/supabase-seed-data branch May 22, 2026 14:10
@gkhngyk gkhngyk mentioned this pull request May 26, 2026

This branch had an error being deployed

1 failed and 1 active deployments
Preview — 63de5022 Deployed May 22, 2026 by vercel[bot]
staging - docs — 63de5022 Deployed May 22, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant