Concepts

Forks

Branch a briq, or a whole stack, before a change you might want to undo.

A fork is a new briq that starts from a copy of another briq's volume. The source keeps running and never sees what the fork does. Keep the fork, or destroy it to throw the attempt away.

Use it to try what cannot be taken back (run a migration on a fork first), or to try two approaches side by side.

briq fork bq_7kq2m9x1p4ab
briq_fork({ briq: "bq_7kq2m9x1p4ab" })
→ forked into stack default · copied disk: processes start fresh on a copy of the source volume as of now
  bq_3m1x8kq2c7ta db-fork (postgres:16) running · fork of bq_7kq2m9x1p4ab · …internal · cost so far … · sleeps at 18:42 UTC unless used
  outputs:
    DATABASE_URL=postgres://postgres:…@…internal:5432/app
curl -X POST https://api.briq.cloud/v1/briqs/bq_7kq2m9x1p4ab/fork \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"wait": true}'

What is copied

Each fork reports what it got in copied:

copiedThe fork getsWhen
diskThe volume as it was at the forkThe source has a volume (every database recipe does)
configImage, command, env, secrets and boot files, no dataThe source has no volume

Memory is not copied: processes start fresh on the copied disk, as after a power cut, and databases recover as they are built to. For a clean copy, briq_stop the source first.

A fork never starts its source: a sleeping briq stays asleep.

Not copied: its URL (expose the fork yourself), files written outside the volume (boot files are config, and copied), and any link between the two. Destroying one leaves the other running.

A fork keeps its source's secrets (a database keeps the password it was created with). Its outputs point at the fork.

Launch from a prepared disk

briq stop bq_7kq2m9x1p4ab
briq fork bq_7kq2m9x1p4ab --name worker --cmd 'python /work/worker.py'

Prepare a raw-image briq with a volume. Flush writes and save application data before stopping the briq. Keep the source unchanged while launching workers from its disk.

Pass cmd to start the fork with a different command. MCP and REST accept a string or an argv array:

briq_fork({ briq: "bq_7kq2m9x1p4ab", cmd: ["python", "/work/worker.py"] })
curl -X POST https://api.briq.cloud/v1/briqs/bq_7kq2m9x1p4ab/fork \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cmd": ["python", "/work/worker.py"]}'
  • cmd replaces CMD. The image ENTRYPOINT, environment, boot files, healthcheck, ports, size, volume and secrets are inherited.
  • Keep the new command compatible with the inherited healthcheck and ports.
  • A string runs with sh -c; an argv array is passed directly to the image ENTRYPOINT.
  • Only single raw-image forks with a copied volume accept cmd. Recipes and stack forks refuse it.
  • Leave cmd out to keep the source command. The source configuration stays unchanged.
  • Each fork starts fresh processes on its own writable disk. Memory is not copied. Save application data before stopping the source.

Names and stacks

You passThe fork is
briq<name>-fork in the same stack (then -fork-2, …)
briq, nameThat name, in the same stack
briq, stackThe source's name, in that stack
stackEvery briq of the stack, same names, in <stack>-fork (or into)

Because names are kept, a forked app talks to the forked database with no configuration change:

briq fork --stack shop --into shop-migration
briq_fork({ stack: "shop", into: "shop-migration" })
→ forked into stack shop-migration · copied disk: …; config only: …
  bq_… db   running · fork of bq_…
  bq_… api  running · fork of bq_…
curl -X POST https://api.briq.cloud/v1/stacks/shop/fork \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"into": "shop-migration", "wait": true}'

A briq that refers to a sibling ({{briq:redis}}) cannot be forked alone into a stack without a briq of that name.

A stack fork is all or nothing: if one fork is refused, the others are destroyed and the call fails. Briqs in error are left out and listed in skipped.

See Give each Claude Code worktree its own database for git and Claude Code hooks.

Reach a fork from outside

A fork's outputs are internal addresses: the briqs of its stack reach them, a laptop does not. Pass expose to use the fork from outside briq:

briq fork --stack main --into feat-login --expose private
briq fork --stack main --branch feat/login --env .env.local --expose
briq destroy --branch feat/login

--into names the new stack; --branch names it after a git branch (feat/login → feat-login). --env writes the outputs into a dotenv file: existing keys are replaced, other lines kept. A new file is readable by you only. --expose defaults to private URLs; --expose public makes them public.

briq_fork({ stack: "main", into: "feat-login", expose: "private" })
→ DATABASE_URL=postgres://postgres:…@db-k3f9a2x7qm.tcp.briq.run:5432/app?sslmode=require
curl -X POST https://api.briq.cloud/v1/stacks/main/fork \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"into": "feat-login", "expose": "private", "wait": true}'
BriqGets
A recipe's database (Postgres, MySQL, Redis, MongoDB…)A TCP endpoint over TLS. See Connect from outside
A front door (a web app, an inbox)A URL in the mode given: "private" (only whoever has it) or "public"
  • The outputs keep their keys and name those endpoints, TLS on (sslmode=require or the protocol's own).
  • It waits for the forks. One not running yet keeps its internal outputs, named in warning.
  • The endpoints go with the fork: destroying the stack removes them.
  • Left out, nothing gets a hostname on the internet.

Limits and cost

A fork is a new briq: it counts against the agent's policy and the team's credits, checked before anything is copied, and bills per second. It runs in its source's region. A briq mid-move returns invalid_state until the move lands.

Discard a fork

briq destroy --stack shop-migration
briq_destroy({ stack: "shop-migration" })
curl -X DELETE https://api.briq.cloud/v1/stacks/shop-migration \
  -H "Authorization: Bearer $BRIQ_API_KEY"

On this page

Free to try

Try briq, on us.

Every new account starts with €10 of credits. No card.

Start building

How can we help?

Message to the briq team