Development setup
Get from a fresh clone to a running local stack. For multi-node clusters on your machine, see Local clusters; for test suites, see Testing.
Dev shell and dependencies
Section titled “Dev shell and dependencies”Enter the Nix dev shell (or run direnv allow—.envrc runs use flake):
nix developpnpm install # web UI, agents sidecar, and sites share one pnpm workspaceThe dev shell provides rustup (pinned by rust-toolchain.toml), just, cargo-nextest,
sqlx-cli, Node 24, pnpm, PostgreSQL 17, oasdiff, cargo-zigbuild + Zig (static Linux builds
for local clusters), llvm-objcopy, and vde_switch (for the VM cluster network), and points
DATABASE_URL at .data/pg.
Develop against your own cluster
Section titled “Develop against your own cluster”Run the UI from your checkout with HMR while sending API calls to a real cluster you’re already enrolled in:
just dev personal # omit `personal` to use ANASTRO_CONTEXT or your default contextjust dev builds anastroctl, starts Vite on a private port, and opens a single-use sign-in link
on a shared authenticated loopback origin (open that link rather than Vite’s raw port). Because API
calls travel over iroh as your enrolled device, actions touch real projects and machines—no local
Postgres or daemon needed. Press Ctrl-C to stop.
For the native desktop app, install tauri-cli once and run:
cargo install tauri-cli --lockedjust dev-app personalThis launches Anastro Dev with its own app ID so your installed Anastro app stays untouched, with HMR for React/CSS and automatic Rust rebuilds for desktop and shared CLI/transport crates.
Useful variants:
just dev personal --listen 127.0.0.1:7482 --no-open # fixed port, print linkcargo run -p anastroctl -- --context personal ui --dev-url http://127.0.0.1:5173 # attach to existing Vitejust cli # rebuild and install anastroctl to ~/.local/binjust app # rebuild and restart the macOS app in ~/Applicationsjust local # bothBuild Anastro inside an Anastro machine
Section titled “Build Anastro inside an Anastro machine”Clone Anastro to /workspace/anastro inside a running machine, enter its dev shell, run
pnpm install, and launch the dev companion from your signed-in computer:
just dev-machine <machine> personal# Or with a custom checkout path:just dev-machine <machine> personal /workspace/my-checkoutThe companion starts Vite inside the machine and prints a loopback URL to open in that machine’s
Browser tab (or ask the agent to open it with browser_open). API requests, streams, and
WebSockets tunnel over your terminal session using your computer’s enrolled device—no device key or
cookie ever enters the guest, and no firewall change is needed.
Press Ctrl-C to close the dev server and tunnel (if the companion disconnects, the guest shuts it
down after ~20 seconds). This workflow targets the cluster’s deployed API; Rust API or sidecar
changes still need a local stack or cluster deployment.
Approve another device by its key
Section titled “Approve another device by its key”On a computer that can reach your cluster over iroh, run anastroctl account device id (or
anastroctl login to print a join string and wait), then approve it from an already-enrolled
machine:
cargo run -p anastroctl -- --context personal account device approve <endpoint-id-or-join-string> --name anastro-devPass --expires-in-days 1 for a temporary dev device. If the new machine doesn’t have a client
file yet, generate a sign-in link with anastroctl account device link and run
anastroctl login --enroll '<link>' there instead.
Run services locally
Section titled “Run services locally”Start each service in its own terminal:
| Command | Starts |
|---|---|
just apid |
Local Postgres in .data/pg + apid on 127.0.0.1:7443 (API docs at /api/docs; .data/iroh/bootstrap-admin becomes first admin if present) |
just machined |
Node iroh endpoint on 127.0.0.1:7444 forwarding to apid (--iroh-allow-any) |
just schedd |
Scheduler and reconcilers (placement, idle spin-down, workspace GC) |
just web |
Vite on http://localhost:5173 proxying /v1, /api, and /healthz to apid (override with ANASTRO_API) |
just agents |
Agents sidecar on 127.0.0.1:7445 with live reload |
Database helpers: just db-up, just db-down, and just db-reset. SQL migrations live in
crates/db/migrations and run automatically when apid boots.
Validate a config repo using anastroctl from source:
cargo run -p anastroctl -- -C examples/prod cluster validateGenerated files
Section titled “Generated files”OpenAPI specs, Cedar policies, config JSON Schemas, and TypeScript API clients are all generated from Rust code. Whenever you change an API or config type, regenerate and commit them (CI fails on drift):
just codegenAfter changing CLI flags or config fields, also regenerate the docs reference pages:
cargo build -p anastroctlpnpm --filter @anastro/docs gen:clipnpm --filter @anastro/docs gen:configBefore you push
Section titled “Before you push”just checkRuns the full CI gate locally: RustSec/cargo-deny, desktop workspace compile, cargo fmt --check,
clippy -D warnings, cargo xtask codegen --check, cargo test --workspace, and web/sidecar
typechecks and tests. Format Rust with just fmt. Check the sites with pnpm check at the repo
root.
The sites
Section titled “The sites”| Directory | Site | Dev command |
|---|---|---|
sites/docs |
Documentation (docs.anastro.dev, Astro + Starlight) |
pnpm dev:docs |
sites/landing |
Landing page (Vite) | pnpm dev:landing |
sites/brand |
Shared tokens.css and SVG marks |
— |
Run pnpm build at the repo root to build everything, or pnpm --filter './sites/*' build for
just the sites. Docs writing guidelines live in sites/docs/STYLE.md.
Repository layout
Section titled “Repository layout”crates/ Rust workspace (see below)web/ Web UI (Vite, React 19, TanStack Router & Query, Tailwind v4)agents/ Pi Durable sidecar (Node, Hono + zod-openapi)desktop/ Tauri desktop and iOS appsapi/openapi/ Generated OpenAPI 3.1 specsapi/policies/ Generated Cedar schemas and policies (from OpenAPI x-roles)schema/ Generated JSON Schemas for anastro.toml and node filesexamples/ Sample config repos (single-node and 3-node prod)docs/spec.md Full design specsites/ Docs site, landing page, and shared brand assetsnix/ package.nix anastrod and anastroctl (`ctl` output) web.nix Embedded web UI Nix build agents.nix Agents sidecar Nix build secureboot-*.nix Key generation and local out-of-store signing tools modules/ Node OS image (anastro.nix, image.nix, slim.nix) cluster.nix Multi-node QEMU VM cluster launcher clusters/ Config repos for local VM clusters (single, ha) tests/ NixOS VM test suites (single, ha, iso) dev/ Dev cluster scripts, dev keys, and VM overlays guest/ Linux microVM guest image, kernel, and KVM test lane kvm-e2e/ Full KVM end-to-end lane and Linux-only test runner kvm-cluster/ Local 3-node KVM container clusterCrates
Section titled “Crates”| Crate | Purpose |
|---|---|
anastrod |
Multi-call daemon binary (apid, machined, schedd, secretd, keyd, opd, relay, hostagent, dwfsd) |
anastroctl |
User and operator CLI |
api |
Axum routers + utoipa annotations, Cedar auth gate, and machined node logic (src/node) |
api-types |
Shared API request/response types |
config |
anastro.toml + node file parsing, merging, validation, apply diffs, and JSON Schema |
db |
Shared Postgres pool and SQL migrations |
iroh-transport |
HTTP/1.1 over iroh streams, apid forwarding, peer allowlisting, and built-in relay |
secretd |
Cluster secret store (in-memory KEK, envelope encryption, Unix socket) |
keyd |
Built-in DWFS workspace key provider |
scheduler |
Machine placement and background reconcilers (schedd) |
hostagent |
Cloud Hypervisor microVM runner (networking, disks, live moves, secrets, git broker) |
guest |
anastro-guest PID 1 inside microVMs (commands and terminals over vsock) |
agent-proto |
Wire protocol between control plane, hostagent, and anastro-guest |
fakehost |
In-process mock host agent for deterministic API/scheduler tests |
dwfs-engine |
Runner-side core of the snapshotted workspace filesystem |
dwfs-control |
DWFS control plane (catalog, leases, head CAS, locations, GC, repacking) |
dwfs-frontends |
Kernel mounts: FUSE on Linux (via virtiofsd), NFSv3 on macOS |
dwfsd |
Per-host DWFS daemon on Linux workers |
objstore |
S3/R2/Garage/local object stores, scoped host credentials, probes, and migration |
inference |
Model accounts, gateway tokens, Codex/Claude/Antigravity logins, and token metering |
integrations |
GitHub App, 1Password resolver (opd), remote MCP connectors, and credential sealing |
agents-client |
Build-time generated Rust client for api/openapi/agents.json |
telemetry |
Logging and OTLP setup |
xtask |
cargo xtask codegen [--check] |
netwatch |
Vendored netwatch 0.19.3 with one rebind-retry patch for iroh |