Connect a database

Self-hosted Postgres

Postgres 13+ with logical replication. anybranch reads the schema and streams changes; your application tables are never written to.

Requirements

$ anybranch preflight postgres 'postgresql://user:pass@host:5432/app' --schemas public

Preflight prints a grant script when reads or ownership are missing. Run it on the source, then re-run preflight until it passes.

What anybranch creates on the source

All named anybranch_<name>: a publication, a replication slot, a schema holding a ddl log table, and an event trigger that records each DDL statement. The DDL table is itself replicated and replayed on the replica, so migrations on production appear on branches, and new keyed tables join replication automatically. The event trigger swallows its own errors, so it can never fail your DDL. rm removes everything it created.

No superuser? The event trigger needs superuser to create. Without it, rows still replicate and status says schema changes are not tracked; run anybranch reconcile <name> after a migration to add the new columns and tables.

Sync

$ anybranch clone prod 'postgresql://user:pass@host:5432/app'
$ anybranch status prod   # initial-copy progress, WAL lag, schema tracking

Client TLS

Pass TLS options in the connection string itself, e.g. ?sslmode=verify-full&sslrootcert=…&sslcert=…&sslkey=….