Create the project
- Go to supabase.com and create a new project
- Pick a region close to your server (latency matters for DB-heavy operations)
- Save the database password somewhere safe
- From Project Settings → API, copy:
Project URLanon publickey → goes intoNEXT_PUBLIC_SUPABASE_ANON_KEYandSUPABASE_ANON_KEYservice_rolekey → goes intoSUPABASE_SERVICE_ROLE_KEY(keep this secret — it bypasses RLS)
Apply migrations
The repo ships SQL migrations undersupabase/migrations/, plus a generated supabase/schema.sql (every migration in one file) for a one-paste fresh install.
- Supabase CLI (recommended)
- Manual via dashboard
supabase/schema.sql is a generated convenience for fresh installs. The numbered files under supabase/migrations/ stay the source of truth and the upgrade path — an existing install applies only the new migration(s) (or supabase db push). Regenerate the consolidated file after adding a migration with bash supabase/build-schema.sh.What the migrations create
- 16 tables (
organizations,profiles,brands,prompts,prompt_results,topics,competitors,content_opportunities,prompt_suggestions,ai_traffic_logs,webhook_configs, etc.) - RLS (Row-Level Security) policies for multi-tenant isolation by
organization_id - An auth trigger that auto-creates a
profilerow when a new user signs up - The
user_roleenum (admin,manager,analyst,agency_partner) - Index optimization for analytics-heavy queries (per-brand, per-day windows)
Demo data (local only)
For local development, the repo shipssupabase/seed.sql — a small idempotent fixture (one demo organization, brand, prompts, ~120 prompt results across all tracked engines, competitors, content opportunities, AI traffic logs). The Supabase CLI runs it automatically the next time you do:
[email protected] / demo123 to land on a populated dashboard. The seed only runs against a local Supabase via the CLI; hosted projects are never touched by it.
Auth configuration
In Supabase dashboard → Authentication → URL Configuration:- Site URL: your web app URL (
http://localhost:3000for dev,https://app.example.comfor prod) - Redirect URLs: add
<site_url>/auth/callback
Storage (optional)
If you’ll let users upload brand logos, create a public storage bucket calledbrand-logos. The web app handles upload/access automatically once it exists.
Continue: Env variables
Full reference for every env var in
web/.env and server/.env.