Simulacrum

Supabase

Connect a Simulacrum-generated app to Supabase Postgres, RLS patterns, migrations, and realtime options.

Create a project

In the Supabase dashboard create a project, then copy the connection string and anon/service keys into .env.local:

bash
DATABASE_URL="postgresql://..."
NEXT_PUBLIC_SUPABASE_URL="https://xxxx.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="eyJ..."
SUPABASE_SERVICE_ROLE_KEY="eyJ..."

Adapter selection

Set database.adapter to supabase in simulacrum.config.ts and run the generated migration flow. Row Level Security policies should align with your auth user IDs from better-auth.

Migrations

Use Supabase CLI migrations or SQL files checked into supabase/migrations. Keep generated schema artifacts reviewed before applying to production.

Realtime

Optional realtime channels can power dashboards; scope channels per tenant or role to avoid leaking events.

Pair this guide with the Supabase walkthrough for an end-to-end checklist.