BranchBase ๐ฟ
Zero-config, Git-native local database branching for PostgreSQL, MySQL, and SQLite.
Stop dropping your local database every time you switch Git branches.
โก The Problem: The "Git vs. Local Database" Friction
Every developer working with Docker, local PostgreSQL, MySQL, or SQLite has suffered this loop:
1. You work on `feature/checkout-v2`.
โโโ Ran migrations: added table `stripe_orders`, added column `users.billing_tier NOT NULL`.
2. Urgent production bug alert! You run:
โโโ `git checkout main`
3. You start the app or run tests on `main`.
4. ๐ฅ CRASH:
โโโ ActiveRecord::PendingMigrationError / PrismaClientKnownRequestError:
"column users.billing_tier does not exist" or "schema mismatch detected".
How developers waste hours today:
- The Nuclear Option:
docker compose down -v && docker compose up -d
(Loses all your test seeds, logins, and mocked state. Takes minutes to re-seed). - The Manual Rollback Dance: Trying to rollback migrations on
feature/checkout-v2before switching, only to lose experimental test data. - The
.envNightmare: Manually maintainingDATABASE_URL_DEV,DATABASE_URL_CHECKOUT, and editing.envon every branch change. - Cloud Branching (Neon, PlanetScale): Great developer experience, but proprietary, paid, and requires an internet connection. It doesn't work for offline development or standard local Docker setups.
๐ The Solution: BranchBase
BranchBase brings instant, zero-copy database branching directly to your local machine and Docker containers.
+---------------------------+
| Developer Machine |
+---------------------------+
|
`git checkout branch-b`
|
v
[ BranchBase Git Hook ]
|
+--------------------+--------------------+
| |
(Detects new branch) (Zero-Copy Snapshot)
| |
v v
+---------------------------------------+ +------------------------------------+
| BranchBase Proxy (Port 5432) | | Local Database (PostgreSQL) |
+---------------------------------------+ +------------------------------------+
| - App connection string NEVER changes | | - `db_project_main` (frozen) |
| - Automatically routes queries to the | | - `db_project_branch_b` (active) |
| active Git branch database! | | (Created instantly via TEMPLATE) |
+---------------------------------------+ +------------------------------------+
Key Highlights
- โก Instant Branching: Creates a fresh, isolated branch database in milliseconds using PostgreSQL
CREATE DATABASE ... TEMPLATEor filesystem copy-on-write (reflink/APFS/Btrfs for SQLite). - ๐ Transparent Connection Proxy: Your app's
DATABASE_URL=postgres://user:pass@localhost:5432/myappnever changes. The local proxy automatically inspects which Git branch is active in your working directory and routes traffic to that branch's database. - ๐ฃ Automated Git Hook: Hooks into
post-checkoutandpost-merge. You simply use standardgit checkoutorgit switch. - ๐งน Automatic Cleanup (
prune): When you delete or merge a Git branch,branchbasesafely tears down the associated ephemeral database. - ๐ด 100% Local & Offline: No cloud telemetry, no subscription fees, no internet needed.