Getting started

Quickstart

Preflight a source, keep a live replica, and cut your first branch — three commands.

Prerequisite: a running anybranch server. The CLI is a thin client that submits jobs; the databases live on the server. See Server deployment. Without ANYBRANCH_SERVER the client fails and never falls back to a local copy.

1. Point the client at your server

export ANYBRANCH_SERVER=https://anybranch.example.com
export ANYBRANCH_TOKEN='<your server access token>'

2. Preflight the source

Preflight checks the database read-only and prints exactly what to fix. It creates nothing and stores nothing.

$ anybranch preflight postgres 'postgresql://user:pass@db:5432/app'
  ✓ connection (PostgreSQL 16.4)   ✓ is writer   ✓ wal level (actual: logical)
  ✓ can replicate   ✓ can read tables   ! replica identity (1 table skipped)
  ✓ Preflight passed.

Exit code is 2 if it does not pass, so it drops straight into a script.

3. Keep a replica, then branch it

# one continuously-synced replica of production
$ anybranch clone prod 'postgresql://user:pass@db:5432/app'

# branch it — ready in seconds, its own URL and credentials
$ anybranch create fix-orders --from prod --print-url
postgresql://you:••••@branches.internal:57375/app

Connect to that URL with any client and work freely. When you are done:

$ anybranch rm fix-orders

The same shape, any engine

Swap postgres for mysql or mongodb in preflight; clone infers the engine from the connection string. See the per-engine guides under Connect a database.