Stakeholder-driven design brief generator. Every contributor fills the same template → Claude generates a concept per person → a diff surfaces tensions → everything exports to Figma.
| Layer | Choice | Why |
|---|---|---|
| Framework | Next.js 15 (App Router) | API routes + React, one repo |
| Hosting | Vercel | Zero-config Next.js deploy |
| Database | Supabase (Postgres) | Persistent storage + auth + realtime |
| AI | Anthropic Claude Sonnet | Concept generation + diff |
| Design export | Figma REST API | One page per respondent + synthesis |
git clone <your-repo>
cd ux-brief
npm install- Create a project at supabase.com
- Go to SQL Editor → New query
- Paste and run the contents of
supabase/schema.sql - Copy your project URL and keys from Settings → API
- Go to Figma → Account Settings → Personal access tokens → Generate
- Create or open a Figma file. Copy the file key from the URL:
https://figma.com/file/FILE_KEY_HERE/...
cp .env.local.example .env.localFill in all values:
ANTHROPIC_API_KEY=sk-ant-...
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
FIGMA_ACCESS_TOKEN=figd_...
FIGMA_FILE_KEY=your-figma-file-key
NEXT_PUBLIC_APP_URL=http://localhost:3000npm run devOpen http://localhost:3000/admin
- Create a session — give it a project name and paste stakeholder emails
- The app generates a unique magic link per email (no passwords)
- Share each link with the relevant person
- Monitor response count in the sessions list
- Once ≥2 responses are in, click Run diff then Export to Figma
- Open their unique link
- Fill in identity (name, role, layer)
- Complete 8 sections of the questionnaire
- Claude generates their concept server-side
- Done — they see a preview of their concept's hero
- Called server-side after each respondent submits
- Anthropic API key never touches the browser
- Structured JSON output: hero, scroll structure, visual system, conversion logic, open tensions
- Stored in Supabase
conceptstable
- Runs automatically when
min_respondents_for_diffis reached - Re-runs each time a new concept is added (latest overwrites previous)
- Outputs: aligned points, named tensions, workshop priority decisions
- Stored in
diffstable (one row per session, upserted)
- Creates one Figma page per respondent, named
Name · Role - Each page contains annotated frames: Hero, Scroll structure, Visual system, Conversion logic
- Creates a final
⚡ Synthesispage with tensions in red, alignments in green - Stores Figma node IDs back on concept rows for deep-linking
app/
api/
generate/ → POST: generate concept (Claude)
diff/ → POST: generate diff (Claude)
figma-export/ → POST: export to Figma
sessions/ → POST: create session | GET: list sessions
admin/ → Admin dashboard
brief/[sessionId]/ → Stakeholder questionnaire (token-gated)
dashboard/[id]/ → Diff view (build this next)
lib/
prompts.ts → All Claude prompt builders + JSON parsers
sections.ts → Single source of truth for questionnaire sections
supabase-browser.ts → Client-side Supabase (anon key)
supabase-server.ts → Server-side Supabase (service role)
types/
index.ts → All shared TypeScript types
supabase/
schema.sql → Full DB schema — run this first
npm i -g vercel
vercelSet all environment variables in Vercel dashboard: Project → Settings → Environment Variables
Change NEXT_PUBLIC_APP_URL to your production URL before deploying.
/dashboard/[sessionId]— realtime diff view using Supabase's realtime subscriptions/api/sessions/[id]/validate-token— token validation endpoint (required by brief page)/api/sessions/[id]/respondents— save respondent to DB (required by brief page)- Email delivery via Resend — send magic links automatically on session creation
- Figma plugin — richer layout generation beyond annotated text frames