LaraCopilot
LaraCopilot
Integrations

Supabase Postgres

Swap the default SQLite database for a Supabase-hosted Postgres database in any LaraCopilot project with a single toggle — no manual config needed.

LaraCopilot can swap the default SQLite database in any generated project for a Supabase-hosted Postgres database. You connect your Supabase account once, then attach a database to any project from its IDE — either auto-creating a fresh Supabase project or linking an existing one.

This integration is database-only. Supabase Auth, Storage, Edge Functions, and Realtime are not wired into the generated app.

Step 1 — Connect your Supabase account

  1. In LaraCopilot, open Supabase from the sidebar
  2. Click Connect with Supabase — you'll be redirected to authorize LaraCopilot in your Supabase account
  3. Approve the request — you're returned to LaraCopilot with the connection marked active

You only need to do this once. The same connection is reused for every project you link.

Using a Personal Access Token instead

If OAuth isn't available (e.g. self-hosted Supabase), expand Use a Personal Access Token instead (advanced) on the Supabase page and:

  1. Generate a token at supabase.com/dashboard/account/tokens
  2. Paste it into the Personal Access Token field
  3. Add an optional label (e.g. "Personal account") and click Save & Verify

Tokens are stored encrypted and the value is never shown again — only the last 4 characters appear in the UI.

Step 2 — Attach Supabase to a project

  1. Open the project in the IDE
  2. Click SettingsIntegrations
  3. Toggle Supabase Postgres on — a confirmation modal opens

LaraCopilot checks whether you already have a Supabase project with the same name as your LaraCopilot project's unique ID, and offers one of two flows.

Option A — Create a new Supabase project

If no matching project exists (or you choose Create new in the modal):

  1. Pick a region close to your users
  2. Click Create & link

LaraCopilot then:

  • Creates a fresh Supabase project named after your LaraCopilot project
  • Generates a strong database password
  • Writes the connection details to your project's .env
  • Runs Laravel migrations against the new database

The whole flow takes roughly 1–3 minutes while Supabase provisions the project. Keep the page open until it completes.

Option B — Use an existing Supabase project

If a Supabase project with the same name already exists, choose Use existing:

  1. Paste the database password you set for that Supabase project
  2. Click Link

You're asked for the password because Supabase's API does not expose passwords for existing projects — only you know it. If you've forgotten it, reset it in the Supabase dashboard under Project Settings → Database.

Step 3 — Verify it worked

  1. Open your Supabase dashboard → Table Editor
  2. You should see your Laravel migration tables (e.g. users, migrations, password_reset_tokens)

In LaraCopilot, the IDE Settings → Integrations panel shows the linked project's name, region, and pooler host.

Re-running migrations

After editing migration files, click Run migrations in the IDE Settings → Integrations panel. The artisan output is shown in a debug panel so you can see exactly what ran.

LaraCopilot uses the Supabase session pooler (IPv4, supports prepared statements). The transaction pooler is never selected automatically because it doesn't support prepared statements, which Laravel relies on.

If a migration fails because the pooler hostname doesn't resolve, LaraCopilot transparently tries other regional cluster prefixes (e.g. aws-0-..., aws-1-...) until one connects. This is automatic — no action required.

Unlinking a project

To disconnect a single project from Supabase:

  1. Open the IDE → SettingsIntegrations
  2. Toggle Supabase Postgres off (or click Unlink)

LaraCopilot:

  • Removes all Supabase fields from the project record
  • Resets DB_CONNECTION to sqlite in the project's .env
  • Recreates the local SQLite file and re-runs migrations against it

The Supabase project itself is left untouched — you can re-link to it later or delete it manually from the Supabase dashboard.

Disconnecting your entire Supabase account

To remove the LaraCopilot ↔ Supabase connection altogether:

  1. Go to Supabase in the sidebar
  2. Click Disconnect Supabase and confirm

This:

  • Deletes your stored token / OAuth credentials
  • Reverts every linked project back to SQLite in a single transaction

No Supabase projects are deleted on Supabase's side.

Troubleshooting

ProblemSolution
"Something went wrong with Supabase" toastCheck the IDE's debug panel for the artisan output. If linking, verify the database password is correct.
Migrations succeed but tables don't appearRefresh the Supabase dashboard's Table Editor — it caches schema briefly.
"Use existing" asks for a password I don't haveReset the database password in Supabase → Project Settings → Database, then paste the new value.
OAuth button does nothing or shows a generic errorYour LaraCopilot installation may be missing Supabase OAuth credentials. Use the Personal Access Token flow instead, or contact your administrator.
Provision hangs longer than 5 minutesSupabase occasionally takes longer to provision. Re-open the modal; if a Supabase project was created, choose Use existing to link it.

What's stored

ItemWhereNotes
Personal Access TokenEncrypted in supabase_connectionsNever returned to the browser; only the last 4 characters shown
OAuth refresh tokenEncrypted in supabase_connectionsRotated automatically by Supabase on each refresh
Database passwordEncrypted per projectGenerated by LaraCopilot for auto-provisioned projects; collected from you for existing ones
Connection settingsProject's .env (in the container)DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD

On this page