> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-VM project networks & stack branching

> Connect up to 253 KVM computers on an isolated private project network with automatic internal DNS, then branch the entire stack together.

Real software workloads rarely fit inside a single container. Coding agents,
end-to-end QA runners, and evaluation harnesses often need an application server
talking to a seeded PostgreSQL database, Redis cache, or browser worker.

Vers **Projects** give every multi-VM stack its own isolated IPv4 private bridge
and host-managed DNS — with zero guest networking setup — and let you restore a
set of checkpoints together into an isolated sibling project.

![Multi-VM project network stack branching: staging-base with app.internal and postgres.internal restored into isolated attempt-1 and attempt-2 projects.](https://mintcdn.com/vers/mkK48e0NywTcvNla/images/diagrams/project-networks-light.svg?fit=max\&auto=format\&n=mkK48e0NywTcvNla\&q=85\&s=db03ff495b61c0b93e6ef1087552a687)

## How project networks work

* **Automatic private DNS:** Set `vm_config.network_service` (for example,
  `postgres` or `app`) when creating a computer inside a project. Every member
  of that project resolves `<service>` and `<service>.internal` directly over
  the project bridge (`10.64.0.2` – `10.64.0.254`, up to **253** networked
  computers per project).
* **Zero IP collisions across branches:** Each project gets its own isolated
  network namespace. Two branched stacks can both have `postgres.internal` and
  `app.internal` running simultaneously without interfering with each other.
* **Observable topology:** Call `GET /api/v2/projects/{project_id}/network` at
  any time to inspect every endpoint's `service_name`, `computer_id`, and
  private `address` (including sleeping members).

## Walkthrough: branch an App + seeded Postgres stack

This example creates a base project with a `postgres` computer and an `app`
computer reaching it at `postgres.internal:5432`, checkpoints both, and branches
the full stack into an isolated sibling project.

> [tab] Python (httpx)
>
> ```python stack_branch.py theme={"theme":{"light":"min-light","dark":"min-dark"}}
> import os
> import time
> import uuid
> import httpx
>
> client = httpx.Client(
>     base_url=os.environ.get("VERS_ORCHESTRATOR_URL", "https://api.vers.sh"),
>     headers={"Authorization": f"Bearer {os.environ['VERS_API_KEY']}"},
>     timeout=120.0,
> )
>
>
> def wait_op(op: dict) -> dict:
>     op_id = op["operation_id"]
>     while op["status"] == "pending":
>         time.sleep(0.5)
>         op = client.get(f"/api/v2/operations/{op_id}").raise_for_status().json()
>     if op["status"] != "succeeded":
>         raise RuntimeError(f"Operation {op_id} {op['status']}: {op.get('failure')}")
>     return op
>
>
> def import_image(name: str, image_ref: str) -> str:
>     op = client.post(
>         "/api/v2/images",
>         headers={"Idempotency-Key": str(uuid.uuid4())},
>         json={"name": name, "source": {"type": "public_registry", "image_ref": image_ref}},
>     ).raise_for_status().json()
>     return wait_op(op)["result"]["id"]
>
>
> def create_service(project_id: str, image_id: str, service: str, env: dict | None = None) -> str:
>     op = client.post(
>         "/api/v2/computers",
>         headers={"Idempotency-Key": str(uuid.uuid4())},
>         json={
>             "project_id": project_id,
>             "keep_alive": False,
>             "vm_config": {
>                 "oci_image_id": image_id,
>                 "vcpu_count": 2,
>                 "mem_size_mib": 4096,
>                 "fs_size_mib": 16384,
>                 "network_service": service,  # resolves as <service>.internal
>                 "env": env or {},
>             },
>         },
>     ).raise_for_status().json()
>     return wait_op(op)["result"]["id"]
>
>
> # 1. Create the base project and import images
> base_project = client.post(
>     "/api/v2/projects",
>     json={"name": "staging-base", "description": "App + seeded Postgres"},
> ).raise_for_status().json()["project_id"]
>
> pg_image = import_image("postgres-16", "docker.io/library/postgres:16-alpine")
> app_image = import_image("ubuntu-app", "docker.io/library/ubuntu:24.04")
>
> # 2. Boot Postgres and App inside the same project network
> pg_id = create_service(base_project, pg_image, "postgres", {"POSTGRES_PASSWORD": "dev"})
> app_id = create_service(
>     base_project,
>     app_image,
>     "app",
>     {"DATABASE_URL": "postgres://postgres:dev@postgres.internal:5432/postgres"},
> )
>
> # Inspect private DNS members (includes sleeping computers)
> network = client.get(f"/api/v2/projects/{base_project}/network").raise_for_status().json()
> print("Base network endpoints:", network["endpoints"])
>
> # 3. Seed your database / warm your app once, then checkpoint each member
> pg_ckpt = wait_op(
>     client.post(
>         f"/api/v2/computers/{pg_id}/checkpoints",
>         headers={"Idempotency-Key": str(uuid.uuid4())},
>         json={"name": "pg-seeded"},
>     ).raise_for_status().json()
> )["result"]["id"]
>
> app_ckpt = wait_op(
>     client.post(
>         f"/api/v2/computers/{app_id}/checkpoints",
>         headers={"Idempotency-Key": str(uuid.uuid4())},
>         json={"name": "app-warm"},
>     ).raise_for_status().json()
> )["result"]["id"]
>
> # 4. Branch the entire stack into a fresh isolated project ("attempt-1")
> branch_project = client.post(
>     "/api/v2/projects",
>     json={"name": "attempt-1", "parent_project_id": base_project},
> ).raise_for_status().json()["project_id"]
>
> restore = client.post(
>     f"/api/v2/projects/{branch_project}/restore",
>     headers={"Idempotency-Key": str(uuid.uuid4())},
>     json={"checkpoints": [pg_ckpt, app_ckpt], "keep_alive": False},
> ).raise_for_status().json()
>
> # Admission is atomic across all checkpoints; await each restored computer
> restored_ids = [wait_op(op)["result"]["id"] for op in restore["operations"]]
> print("Branched stack computers:", restored_ids)
> # Inside attempt-1, `app` talks to its own isolated `postgres.internal`!
> ```

> [tab] TypeScript (fetch)
>
> ```typescript stack-branch.ts theme={"theme":{"light":"min-light","dark":"min-dark"}}
> import { randomUUID } from "node:crypto";
>
> const BASE_URL = process.env.VERS_ORCHESTRATOR_URL ?? "https://api.vers.sh";
> const API_KEY = process.env.VERS_API_KEY!;
>
> interface Operation {
>   operation_id: string;
>   status: "pending" | "succeeded" | "failed" | "quarantined";
>   result?: { kind: string; id: string } | null;
>   failure?: unknown;
> }
>
> async function api<T>(path: string, init: RequestInit & { idempotent?: boolean } = {}): Promise<T> {
>   const headers = new Headers(init.headers);
>   headers.set("Authorization", `Bearer ${API_KEY}`);
>   if (init.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
>   if (init.idempotent) headers.set("Idempotency-Key", randomUUID());
>   const res = await fetch(`${BASE_URL}${path}`, { ...init, headers });
>   if (!res.ok) throw new Error(`${res.status} ${path}: ${await res.text()}`);
>   return (await res.json()) as T;
> }
>
> async function waitOp(op: Operation): Promise<Operation> {
>   let cur = op;
>   while (cur.status === "pending") {
>     await new Promise((r) => setTimeout(r, 500));
>     cur = await api<Operation>(`/api/v2/operations/${cur.operation_id}`);
>   }
>   if (cur.status !== "succeeded") throw new Error(`Operation failed: ${JSON.stringify(cur.failure)}`);
>   return cur;
> }
>
> // Branch an existing set of networked checkpoints into a new isolated project:
> async function branchStack(parentProjectId: string, name: string, checkpoints: string[]) {
>   const { project_id } = await api<{ project_id: string }>("/api/v2/projects", {
>     method: "POST",
>     body: JSON.stringify({ name, parent_project_id: parentProjectId }),
>   });
>
>   const restore = await api<{ project_id: string; operations: Operation[] }>(
>     `/api/v2/projects/${project_id}/restore`,
>     {
>       method: "POST",
>       idempotent: true,
>       body: JSON.stringify({ checkpoints, keep_alive: false }),
>     },
>   );
>
>   const computerIds = await Promise.all(
>     restore.operations.map(async (op) => (await waitOp(op)).result!.id),
>   );
>   return { projectId: project_id, computerIds };
> }
> ```

> [!TIP]
>
> You can also branch an entire multi-VM project visually with one click using
> **Branch project** in the Vers web Canvas at [vers.sh](https://vers.sh).

## Current boundaries and guarantees

* **Atomic restore admission:** `POST /api/v2/projects/{project_id}/restore`
  validates and admits the entire checkpoint array (1 to 253 distinct networked
  checkpoints) atomically on a single node, returning one durable `Operation`
  per checkpoint in request order.
* **Host-local network:** All members of a project share one host-local bridge
  on the node where the project is placed.
* **Sequential capture today:** Individual computer checkpoints are captured per
  VM (`POST /api/v2/computers/{id}/checkpoints`) rather than via a cross-VM
  simultaneous pause barrier. If you need strict crash-consistent database state
  at capture time, flush or briefly pause writes before checkpointing the DB VM.

## Next steps

> [card] [Custom OCI images](https://docs.vers.sh/guides/custom-images.md)
>
> Push local Docker/OrbStack/Podman builds or pull from public registries.

> [card] [Project API endpoints](https://docs.vers.sh/api-reference/overview.md)
>
> Inspect `/api/v2/projects`, `/network`, and `/restore` in the OpenAPI reference.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.