Supabase Setup
Deploy the Profer backend to Supabase
Supabase Setup
Profer uses Supabase for storage and edge functions. Here's how to deploy your own backend.
1. Create a Supabase project
Go to supabase.com and create a new project.
2. Run the migration
In the Supabase SQL editor, run the migration from supabase/migrations/001_init.sql:
create table cp_pages (
id text primary key,
title text,
html text not null,
questions jsonb default '[]',
version integer default 1,
status text default 'awaiting_feedback',
webhook_url text,
created_at timestamptz default now(),
updated_at timestamptz default now()
);
create table cp_feedback (
id uuid primary key default gen_random_uuid(),
page_id text references cp_pages(id) on delete cascade,
version integer not null,
answers jsonb not null,
reviewer text,
source text default 'page',
created_at timestamptz default now()
);
create index idx_feedback_page_id on cp_feedback(page_id);
create index idx_pages_status on cp_pages(status);3. Deploy edge functions
supabase functions deploy pages
supabase functions deploy view4. Set environment variables
In Supabase dashboard → Edge Functions → Secrets:
| Secret | Value |
|---|---|
PROFER_API_KEY | A secure random string (this is your API key) |
PROFER_PUBLIC_URL | Your public URL for pages (e.g., https://profer.dev) |
SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are automatically available in edge functions.
5. Configure your client
Use the Supabase function URL as PROFER_API_URL:
https://your-project-ref.supabase.co/functions/v1