# dbfork

> Fast local PostgreSQL database branching for migrations, schema testing, and isolated development workflows

Source: https://talira.ai/catalog/dbfork-94t857ss
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [databases / branching](https://talira.ai/categories/databases/branching), [developer tools / testing](https://talira.ai/categories/developer-tools/testing)
- Platforms: linux, macos, windows, cli
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes

dbfork is a Go CLI that branches a local Postgres development database with Postgres's own `CREATE DATABASE ... TEMPLATE`, a server-side copy that takes seconds instead of the minutes a dump and restore takes. It tracks branches in local state, prints a branch's connection string, writes the active branch to a `.dbfork` file in the project, and diffs a branch's schema (tables, columns, indexes) against its source. Each branch is a full copy inside the same Postgres instance, so disk use grows with every branch, and it terminates idle sessions on the source to clone it.

## Links

- Website: https://merup.me/dbfork/
- GitHub: https://github.com/Meru143/dbfork

## Problems it solves

- test a migration on a copy of my local dev database and throw it away after
- pg_dump and restore takes minutes every time I want a fresh copy of my dev database
- give each feature branch its own local Postgres database
- see how a branch's schema differs from the main dev database
- switching git branches leaves my dev database with the wrong migrations applied
- clone a local Postgres database in seconds without Docker or a cloud account

## Features

- branches with CREATE DATABASE ... TEMPLATE
- schema diff against the source
- active branch per project directory
- connection strings as DSN, env or psql

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.23 out of 1.
Signals: maintenance 0.46, adoption 0.14, momentum 0.05, community 0.12, backing 0.00, extensibility 0.20.

- last commit 32 days ago
- 2 commits in the last 90 days
- latest release v0.1.1 8 months ago
- 4 GitHub stars
- 1 contributors

Warnings:

- one or two maintainers (bus factor)

## Alternatives

- [pgbranch](https://talira.ai/catalog/pgbranch-jr3991d7.md): Git branching for your PostgreSQL database
- [DBLab Engine](https://talira.ai/catalog/dblab-engine-egf8da3j.md): Blazing-fast PostgreSQL cloning and branching for dev/test environments and CI
- [pgoverlay](https://talira.ai/catalog/pgoverlay-8z094v1s.md): Instant, writable copy-on-write branches of your real Postgres, self-hosted on plain Docker or Kubernetes. No ZFS required.
- [db-branch](https://talira.ai/catalog/db-branch-590ypapk.md): Instant database branches for MySQL and PostgreSQL, on your own servers
- [Xata](https://talira.ai/catalog/xata-gzxahrpc.md): Open source, cloud native, Postgres platform with copy-on-write branching and scale-to-zero
- [RiftDB](https://talira.ai/catalog/riftdb-dw0e3yr3.md): Instant, copy-on-write database branches for Postgres. Self-hosted. Every PR gets its own database.
