Skip to Content
DocumentationSelf-host1. Set up Supabase

1. Set up Supabase

Everything the web UI and agent need — schema, storage bucket, realtime policies, and a login user — is created by one script, in one run, against a fresh project.

Create a project

Create a project at supabase.com/dashboard . The free tier is enough. A fresh, empty Postgres is what the script expects.

Collect four values

From Project Settings → API Keys:

  • Project URL — https://[REF].supabase.co
  • Publishable key — sb_publishable_…
  • Secret key — sb_secret_… (keep it secret; create one if none is listed)

Older projects show anon and service_role instead — the legacy names for the same two slots. Pass them in the same variables. Projects created after 2025-11-01 only get the new format.

From Settings → Database → Connection string, a Postgres URL. Pick one:

PathWhenForm
DirectYour machine has IPv6postgresql://postgres:[PW]@db.[REF].supabase.co:5432/postgres
Pooler (session mode)IPv4-only networkspostgresql://postgres.[REF]:[PW]@aws-[REGION].pooler.supabase.com:5432/postgres

Use session mode (port 5432), not transaction mode (6543) — the init schema’s session settings must persist across its statements.

Run the script

You need boba, psql and curl on your machine, and a clone of the repo. The script applies the schema with boba db migrate.

SUPABASE_URL=https://[REF].supabase.co \ DB_URL="postgresql://postgres:[PW]@db.[REF].supabase.co:5432/postgres" \ SECRET_KEY=sb_secret_... \ PUBLISHABLE_KEY=sb_publishable_... \ ./scripts/setup-supabase.sh

The script is safe to re-run — the schema step applies only the migrations still pending (each in one transaction, so a failed one leaves nothing behind), and the login user is created only if missing. Re-running is the standard fix for a half-finished setup.

Keep the output

It prints the WEB env block for the web app, the same values as a service.web block for a daemon that serves the web itself, an AGENT / CLI config block, and the seeded LOGIN. You need them in the next two steps.

What it created

  1. The schema — tables, RPCs, indexes, triggers, RLS, grants, and the realtime publication.
  2. The images storage bucket + its RLS policy, so agents can offload image bytes instead of broadcasting them.
  3. Realtime private-channel policies. A fresh project ships realtime.messages with RLS on and no policies, so private:{userId} channels would fail to join. These authorize each user to their own topics, and a guard limits an agent’s terminal topic to your browser login, that agent, or a terminal-scoped token.
  4. A confirmed login user — email/password, so you can sign in without configuring any OAuth provider.
  5. A JWT signer probe — it detects whether your project verifies ES256 or the legacy HS256 secret, and prints only the line you need.

Schema updates

The schema ships as numbered migrations in database/migrations/, compiled into boba; the script applies the ones still pending. A release that changes the schema adds a migration and says so in its release notes. Every migration keeps the previous release’s web app and agents working, so you can update the web app and each agent machine in any order — as long as none of them is more than one release behind. If you skipped a release that shipped a migration, update everything before applying the next one. Apply one with boba db migrate, after checking what is pending with boba db status:

# supabase.com, over the Management API (token: supabase.com/dashboard/account/tokens) SUPABASE_ACCESS_TOKEN=sbp_... boba db migrate --project-ref [REF] # or straight to Postgres, the same DB_URL as above boba db migrate --db-url env:DB_URL

A self-hosted Supabase also works through its own gateway with --url and --secret-key. The options are in docs/reference/database.md.

Deliberately left out

Not gaps — decisions. OAuth providers, SMTP, email templates, and redirect URLs are dashboard settings with no SQL surface; the seeded email/password login exists precisely so none of them block first use. No row data is seeded.


Reference: the full walkthrough — every input, the API-key generations and why they are not just a rename, and the failure mode of each step — is in docs/reference/setup-supabase.md. The schema contract itself is docs/reference/database.md.

Last updated on