Create a database branch with GitHub Actions
A GitHub Actions workflow triggered on branch creation can call the Turso Platform API to seed a new database from an existing one, giving each Git branch its own isolated database. The workflow stores the API token, organization, group and source database name as repository secrets and names the new database after `github.ref_name`. It uses `curl -f` with exit-code checks to fail the job on API errors, then extracts the returned Hostname with `jq` and exports it to `GITHUB_ENV` for later steps such as deployments. Branch names must contain only lowercase letters, numbers and hyphens to be valid database names, and the official `tursodatabase/create-database-action` wraps the same logic.
Related posts
- Branching Postgres databases with the Neon API
Neon mediumAdept
Neon branches are copy-on-write clones of a Postgres database that can be created and deleted through the Neon API, giving CI pipelines an isolated copy of production data for end-to-end tests. Two experimental GitHub Actions, neondatabase/create-branch-action and neondatabase/delete-branch-action, wrap the API. A sample pull-request workflow creates a branch from a parent branch, runs the test steps, then deletes the branch. The actions were beta at the time and still being hardened for production use.
- Supabase Branching
Supabase mediumAdeptSupabase Branching gives each Git branch an isolated hosted Preview environment with its own Postgres database, Auth, Storage, Realtime, Edge Functions and APIs, plus separate credentials. A GitHub app runs migrations from ./supabase/migrations when a PR opens, applies new migration files incrementally on push, seeds from seed.sql, and runs the migrations against production on merge. It integrates with Vercel Preview deployments by auto-populating branch connection secrets. Early access is rolling out in batches to paid orgs, with copy-on-write snapshots, declarative config and automatic dashboard commits planned.
- Database migrations with Geni and libSQL
Turso mediumAdeptGeni is a lightweight CLI that manages schema changes as paired up/down SQL files, applying each migration inside a transaction so a failed migration leaves the database unchanged. The walkthrough covers installing Geni, pointing it at a Turso/libSQL database (or a local SQLite file) via DATABASE_URL and DATABASE_TOKEN, creating and applying migrations, rolling back with `geni down`, and checking status. It closes with a GitHub Actions workflow that applies migrations automatically on pushes to main.
- Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd
Neon mediumAdept
Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database. GitHub Actions call the Neon API to create a branch when a PR opens and delete it on merge. Changes then flow from per-developer and per-PR branches to staging and production, with Render pre-deploy commands applying migrations tracked in a dedicated timestamped table. The team credits branching with removing the cost and effort of keeping test instances synced with production, and notes that scale-to-zero means it no longer pays for idle databases.
- Vercel setup guide
Turso mediumAdeptDeploying a Nuxt app backed by a Turso database to Vercel comes down to two environment variables, NUXT_TURSO_DB_URL and NUXT_TURSO_DB_AUTH_TOKEN, which the libSQL TypeScript client uses to connect. The guide creates and seeds a SQLite-compatible Turso database via the CLI shell, gets the database URL with `turso db show --url`, and generates a non-expiring token with `turso db tokens create`. Deployment can go through the Vercel deploy button or through manually forking the repo and importing it on the Vercel dashboard, and Vercel then redeploys automatically on pushes to the production branch.