Branches

A preview branch is a separate project with its own database, auth realm and API keys, created from another project's schema (and optionally its data). Try a migration or a feature there; the original project is never touched. Branches are meant to be disposable — a pull request, a staging copy, an experiment.

What a branch copies

ModeCopies
Schema only (default)Tables, views, functions and policies, with no rows. Fast at any size.
Schema and dataEverything above plus every row as of the moment you create it. Refused when the database is larger than the full-copy limit (2 GB by default) — branch schema-only instead.

Not copied: auth users, storage files, flows and realtime settings. A branch starts with an empty auth realm and empty buckets, and gets its own API keys.

In the dashboard

Open your project and choose Branches.

  • New branch — enter a name such as pr-42 or staging and choose Schema only or Schema and data. The branch appears in the list while it is being populated and shows pending, ready or failed; a failure shows its reason.
  • Open a branch like any other project, with its own tables, keys and connection details.
  • Delete — moves the branch to the trash, like any project. It is purged after 24 hours, and its name is free again immediately.

Rules and limits

  • Names are 2–40 characters: lowercase letters, digits and hyphens, starting and ending with a letter or digit. A name is unique per parent project.
  • Only an active SQL project can be branched. NoSQL projects, projects on a dedicated database and projects that are not active are refused.
  • Branches are one level deep: a branch cannot be branched again — create further branches from the parent.
  • Up to 3 live branches per project by default; delete one to create another.
  • Branching is part of your plan's entitlements; creating a branch is refused if the plan does not include it.
  • There is no merge. A branch is a copy to experiment on; to bring a change back, run the same migration on the parent project.

REST API

Routes are under https://api.basefyio.com/api/projects/:projectId/branches, where :projectId is the parent project. They need a dashboard session or a platform API token with the projects:read (list) or projects:write (create, delete) scope.

MethodPathDescription
GET/List branches (name, status, data mode, sync status and error, created)
POST/Create { name, dataMode? } — dataMode is "schema" (default) or "full"
DELETE/:branchIdMove the branch to the trash

Example

# Create a schema-only branch
curl -s -X POST https://api.basefyio.com/api/projects/$PROJECT_ID/branches \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"pr-42","dataMode":"schema"}'

# List branches, then delete one
curl -s https://api.basefyio.com/api/projects/$PROJECT_ID/branches -H "Authorization: Bearer $TOKEN"
curl -s -X DELETE https://api.basefyio.com/api/projects/$PROJECT_ID/branches/$BRANCH_ID -H "Authorization: Bearer $TOKEN"

Creation returns right away with the new project and its previewBranch details; the copy continues in the background, so poll the list until the sync status is ready.