Xata
- A Kubernetes cluster (minikube works fine for this tutorial)
kubectlconfigured to access your cluster- A Xata account with a database created
- A Signadot account with the operator installed
- The
xataCLI installed and authenticated - The
signadotCLI installed and authenticated psql(PostgreSQL client) for database operations
Xata requires initial database creation through the dashboard. Once that exists, all subsequent branch operations work via CLI.
Overview
Ephemeral environments solve the "it works on my machine" problem for application code. But what about the database? When five developers test against the same staging database, test data collides, schema migrations conflict, and debugging becomes a nightmare. The environment might be ephemeral, but the shared database state is not.
Xata solves this with copy-on-write database branching. Each branch inherits the full schema and data from its parent but operates in complete isolation. Writes to a branch never affect the parent. Combined with Signadot's sandbox isolation for application workloads, you get true full-stack isolation: every sandbox gets its own forked pods and its own database branch.
This tutorial demonstrates how to automate this integration. When a Signadot Sandbox spins up, a Resource Plugin creates an isolated Xata branch. When the sandbox terminates, the branch is deleted. No manual intervention. No leftover resources.
How It Works
The integration relies on two components:
Xata Database Branching: Xata implements branching at the storage layer using copy-on-write semantics. Creating a branch takes seconds regardless of database size because no data is physically copied until a write occurs. Only diverging blocks are duplicated. A 100GB database branches just as fast as a 1GB one.
Signadot Resource Plugins: Resource Plugins extend Signadot's sandbox lifecycle with custom provisioning logic. When a sandbox starts, the plugin executes a create workflow. When the sandbox terminates, it executes a delete workflow. Outputs from the create workflow (such as database connection strings) can be injected directly into sandbox pods as environment variables.
The Integration Flow:
Project Structure
Clone the example repository:
git clone https://github.com/signadot/examples.git
cd xata-branching-tutorial
The repository contains everything needed for this integration:
xata-branching-tutorial/
├── db/
│ ├── schema.sql # Table definitions
│ └── seed.sql # Sample data
├── pkg/users-service/
│ ├── app.js # Express.js API
│ └── package.json
├── docker/
│ └── users-service.Dockerfile