Contributing to BranchBase
Guidelines, development workflow, and pull request standards for contributors to BranchBase.
Getting Started for New Contributors
If you are looking for approachable tasks to get started, check our curated newcomer issues: - Good First Issues on GitHub - BranchBase on Up For Grabs
Each newcomer issue includes exact file pointers, reproduction steps, and expected behavior. Maintainers are actively available to guide you through your first PR!
Areas of Contribution
Here are some high-impact areas where we need collaboration:
- Database Drivers:
- PostgreSQL Driver (
CREATE DATABASE ... TEMPLATE) — Implemented. - SQLite Driver (Reflink / APFS
clonefile/ Btrfs / XFS) — Implemented. - MySQL / MariaDB Driver (
CREATE TABLE ... LIKEschema cloning) — Implemented. - MongoDB Driver (Aggregation cloning & index replication) — Implemented.
- CockroachDB / TiDB Driver — Open for contribution.
- Transparent Proxy Engine:
- Wire-protocol parsing for PostgreSQL
StartupMessage— Implemented. - TLS/SSL negotiation (
sslmode=require) — Implemented. - UNIX domain socket support — Implemented.
- Graceful connection draining — Implemented.
- Wire-protocol parsing for MySQL Handshake — Implemented.
- CLI & Developer Experience:
- Git hook installation & integration tests — Implemented.
- Interactive TUI (Terminal UI) dashboard — Implemented.
- Autocompletion scripts (bash, zsh, fish, powershell) — Implemented.
branchbase doctordiagnostic command — Implemented.- Documentation & Guides:
- Prisma ORM integration guide — Implemented.
- Integration guides for: Drizzle, Django, Ruby on Rails, Alembic/SQLAlchemy, TypeORM.
Development Setup
Prerequisites
- Go (1.26+ or latest stable).
- Docker & Docker Compose (for running local test databases).
- Git (2.30+).
Clone & Build
git clone https://github.com/oscarbol09/branchbase.git
cd branchbase
# Download dependencies
go mod download
# Run local tests
go test ./...
# Build the CLI binary
go build -o bin/branchbase ./cmd/branchbase
Implementing a New Database Driver
To add support for a new database, implement the Driver interface defined in internal/driver/driver.go:
package driver
import "context"
type Driver interface {
Name() string
Ping(ctx context.Context) error
BranchExists(ctx context.Context, branchName string) (bool, error)
CreateBranch(ctx context.Context, sourceBranch, targetBranch string) error
DeleteBranch(ctx context.Context, branchName string) error
ListBranches(ctx context.Context) ([]BranchInfo, error)
Close() error
}
- Create a new package under
internal/driver/<engine>/. - Implement all interface methods.
- Add unit and integration tests.
- Register the driver via
driver.Register("<engine>", factory)ininit(). - Open a Pull Request!
[!NOTE] Optional Connection Pool Parameters:
The factory functionfunc(params map[string]interface{}) (Driver, error)receives configuration values from.branchbase.yaml. For short-lived operations (such ashook-trigger), BranchBase passes lightweight pool limits intoparams: -max_open_conns(int): Maximum concurrent open database connections (e.g.,1in lightweight mode). -max_idle_conns(int): Maximum idle connections retained in the pool (e.g.,1in lightweight mode).Database drivers supporting connection pooling should inspect these parameters and apply them to their connection pool.
Pull Request Guidelines
- Keep it Focused: A pull request should do one thing well. Avoid bundling unrelated refactors.
- Write Tests: If you are fixing a bug or adding a feature, please include automated tests.
- Conventional Commits: We follow the Conventional Commits convention:
feat: add postgres startup packet rewriterfix: handle detached HEAD state in git resolverdocs: update quickstart guide for Rails users- Documentation: Update the
README.mdorARCHITECTURE.mdif your change modifies user-facing behavior.
Community & Questions
- GitHub Discussions: Use Discussions for architecture proposals, RFCs, and questions.
- Issues: Use GitHub Issues for bug reports and tracked feature requests.