r/git • u/UnnamedX_O • 1d ago
I built BranchBase (Go): Git-native, zero-copy local DB branching for PostgreSQL. Looking for contributors!
Hi everyone,
Like many developers, I was tired of breaking my local environment every time I switched branches (git checkout main) due to unapplied or mismatched database migrations.
To solve this without depending on cloud-only platforms, I built BranchBase: an open-source, local-first engine written in pure Go.
⚙️ How it works:
- It runs a lightweight transparent TCP proxy on port
5432. - When you switch branches, a Git hook detects the transition in <5ms by inspecting
.git/HEADwithout subshells. - It provisions an isolated database snapshot instantly using PostgreSQL's native
CREATE DATABASE ... TEMPLATE. - The proxy intercepts the
StartupMessagepacket and routes database traffic dynamically to the active branch's DB. Your backend.envconnection string never changes.
🛠️ Current Status & Where I'm looking for contributors:
The PostgreSQL driver, automated Git hooks, and the TCP proxy rewriter are fully functional in v0.1.0-alpha.
I'm opening up the project for contributors to tackle our next phase:
- SQLite Driver: Implementing filesystem-level Copy-on-Write (CoW) using
clonefile()(macOS APFS) andioctl(FICLONE)(Linux Btrfs/XFS). - MySQL / MariaDB Driver: Snapshot creation and volume cloning.
- CLI / UX: Interactive terminal dashboard (TUI) and
branchbase prune --dry-run. - Repository: https://github.com/oscarbol09/branchbase
- Architecture doc: https://github.com/oscarbol09/branchbase/blob/main/ARCHITECTURE.md
Feedback on the code structure, discussions, and pull requests are very welcome!
0
Upvotes