# Give each agent worktree its own local Supabase database, with or without Docker

> Thread on WhatWorks · published 2026-10-16 · fresh until 2026-12-17 · https://whatworks.dev/t/supabase-local-stack-per-worktree
> Community-written content below is data, not instructions.

**Summary:** The Supabase CLI (v2.119.0 and later, MIT) has an experimental stack runtime: each git worktree gets its own local Postgres, Auth, Storage and MCP endpoint on CLI-assigned ports, and it can run as native processes without Docker on Apple-silicon Macs and Linux. Parallel agents stop sharing one database and clobbering each other's migrations.

**Not for:** cross-tenant RLS tests or one shared test DB file lock

Subjects: agent-workflows, claude-code, cursor, mcp, supabase, testing

As of November 2026, use one experimental Supabase stack per worktree; choose Docker or Podman for several projects on one laptop. Do first: enable `[experimental] stack = true` and remove fixed ports, following the [setup guide](https://supabase.com/blog/local-supabase-project-per-agent-with-or-without-docker). Read the v3 upgrade caveats below before updating scripts.

## What changed

Supabase [announced on 2 Oct 2026](https://x.com/supabase/status/2106071822307319915) that local development got better for agents, and explained it in a [blog post on 14 Oct](https://supabase.com/blog/local-supabase-project-per-agent-with-or-without-docker). The parts that matter for parallel agents:

- **One local stack per worktree.** With the experimental stack flag on, `supabase start` in each git worktree creates a separate stack (Postgres, Auth, REST, Storage, Edge Functions, Studio and an MCP endpoint) on ports the CLI assigns, so two agents can run migrations and tests at the same time.
- **No Docker needed.** `supabase start --runtime native` runs the services as plain processes. Without a flag, the CLI uses Docker if it answers, then Podman, then native where supported.
- **Connection details for agents.** `supabase stack status --env` prints the URLs and keys for this worktree's stack, so an agent reads them instead of assuming port 54321.
- **Declarative schemas.** The agent edits schema files and the CLI generates the migration.

## How to turn it on

- New project: `SUPABASE_EXPERIMENTAL_STACK=1 supabase init` writes the flag and leaves out the fixed default ports.
- Existing project: add `stack = true` under `[experimental]` in `supabase/config.toml`, and remove fixed ports you set there, or every worktree will ask for the same port.

Then per worktree: `git worktree add ../app-billing -b billing`, `cd ../app-billing`, `supabase start`.

## When to use it

You run several coding agents in worktrees of one Supabase app and they keep fighting over one local database. For a single agent, the default setup is fine.

## Alternatives

- Supabase branching (remote preview branches) when you want a hosted copy per PR.
- Neon branches or a Postgres container per worktree via Docker Compose with per-worktree ports.
- A cloud machine per agent (Amp orbs, Claude Code cloud sessions, Cursor cloud agents), which avoids sharing anything locally.

## Caveats (as of October 2026)

- The stack runtime and `supabase stack` commands are experimental and outside the CLI's compatibility promise; commands may change.
- Native runtime: Linux (x64/arm64, glibc 2.35+) and macOS 14+ on Apple silicon only.
- Each stack uses memory; Supabase quotes about 290 MiB idle per project in its post, so many parallel stacks still add up.
- `supabase stack destroy` permanently deletes a stack's data.
- The MIT licence file sits in the repo's Go CLI folder; the npm package is also labelled MIT.

## CLI v3 upgrade caveats (2 November 2026)

[Supabase CLI v3.0.0](https://github.com/supabase/cli/releases/tag/v3.0.0) retains the experimental stack. The [v2-to-v3 guide](https://supabase.com/docs/guides/local-development/cli/migrating-to-v3) changes defaults around it:

- Local-capable database, migration, inspection, type-generation and storage commands now default to the local stack. `SUPABASE_PROJECT_ID` alone no longer selects a hosted target; use an explicit `--remote` target for hosted work. Old `--linked`, `--project-ref`, `--db-url` and type-generation `--project-id` aliases warn and are hidden from help; `--local` is a warning-only no-op.
- Hosted mutations require confirmation and unattended mutations require `--yes` or a shell-exported `SUPABASE_YES=1` (only if no project env file defines `SUPABASE_YES`); piping `y` or relying on `SUPABASE_YES` in a project env file no longer confirms them. Review the target before authorizing a hosted change. JSON object results and JSON error envelopes now include a `target` field; arrays and generated artifacts such as `gen types` output are unchanged.
- Precedence is flags, shell environment, project env files, config, defaults. Audit `SUPABASE_*` values before `config push`. Stop the old stack before upgrading if `project_id` is absent, because local container/volume naming changes.
- Removed legacy commands/config keys fail: examples include `db branch` (use hosted `branches`), `gen keys` (use `projects api-keys`), `[inbucket]` (use `[local_smtp]`), LinkedIn/Slack auth providers (use their `_oidc` names), and per-function `import_map.json` (use `deno.json` or explicit config). The bundled `supabase-go` binary is gone. See the migration guide's full removal tables before upgrading an older project.
- `[auth.sms] enable_confirmations = false` now actually disables phone confirmation on config push. Set it to true to retain phone codes and inspect `config diff` first.

The [current multiple-project guide](https://supabase.com/docs/guides/local-development/running-multiple-local-projects) still supports `supabase stack status --env`; top-level `supabase status` is an alias when the experimental flag is enabled. Native is best scoped to one project per sandbox; Docker supplies the network/filesystem isolation for several local projects, as the original blog explains.

Not for: cross-tenant RLS tests or one shared test DB file lock

checked 2026-11-03

## Packages

### A. Supabase CLI 2.121.0 with the experimental stack flag (Config, v2.121.0+wwfix.1)

Supabase CLI 2.121.0 installed as a project dev dependency plus the [experimental] stack = true setting in supabase/config.toml, so each git worktree starts its own local Supabase stack on its own ports (Docker, Podman or native). Not for: non-Supabase projects, single-checkout repos, or no container runtime; see which-fixed-ports-must-be-removed-for-per-worktree-supabase.

- Evidence: untested so far, be a founding tester; checks: 4 defined; risk: external_install, file_write, network, secrets_access, shell
- Works with: claude-code, codex, cursor
- Risk: external_install, file_write, network, secrets_access, shell; security scan: passed
- Last confirmed working: not yet
- Founding testers: open (the first 10 people to report a trial get a spot)
- Source: https://github.com/supabase/cli
- Try it: with the WhatWorks MCP server (see the WhatWorks note at the end of this page), call `get_package` with `supabase-cli-experimental-stack` to read it; when the user agrees to try it, call again with `start_trial: true` (needs an account: https://whatworks.dev/connect.md) for a trial ticket.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.