Configuration basics
An environment is described by one file, alzo.config.ts, at the repository root. It declares nodes — the things Alzo runs — as ordinary constants, and exports a defineConfig call that names the graph's roots:
import { defineConfig, defineService } from 'alzo';
const db = defineService({
name: 'db',
ports: { pg: 5432 },
env: { POSTGRES_PASSWORD: 'dev' },
provision: { image: 'postgres:17' },
ready: { exec: 'pg_isready -U postgres', in: 'container' },
});
const api = defineService({
name: 'api',
ports: { http: {} },
run: (self) => `node server.js --port ${self.port.http}`,
dependsOn: [db.available],
env: () => ({ DATABASE_URL: `postgres://postgres:dev@${db.address.pg}/postgres` }),
});
export default defineConfig({
name: 'acme',
nodes: () => [api],
});Run alzo check after editing it. It type-checks the file and validates the graph without starting anything; alzo up then starts the graph.
Kinds of node
| Constructor | Declares |
|---|---|
defineService | A long-running process, either a container or a host process. See Services. |
defineBuild | Work that produces files other nodes consume, run once or as a watcher. See Builds. |
defineTask | Finite work that runs to completion, such as a migration or a seed. See Tasks. |
defineInfo | A dashboard panel that belongs to the workspace rather than to a service. See Dashboard. |
Three more functions complete the surface: defineIngress declares the HTTPS front door (Networking), forward lets two nodes refer to each other's addresses (Networking), and secret and param read credentials and run-time flags (Secrets and parameters). instance describes the current worktree's environment (Parallel environments).
Every node name is a DNS label — a lowercase letter, then lowercase letters, digits and internal hyphens, at most 54 characters — because it becomes part of the node's hostname.
References are variables
Nodes are ordinary const bindings, so dependencies are lexical: dependsOn: [db.available] resolves against the variable declared above it. Declaration order is dependency order, and the scheduler only confirms what you can already read from top to bottom. A misspelled node is a TypeScript error, not a runtime lookup failure.
That guarantee holds for references written eagerly — dependsOn, restartOn, buildDependsOn, attach.to and name — which are read as the file executes, so referring to a node declared further down is a TypeScript "used before declaration" error. References inside a callback (env, run, links, outputs) are read later, after Alzo has allocated ports and hostnames, so reading a node declared further down compiles and works. That is deliberate: it is what makes two nodes able to refer to each other's addresses. But a genuine cycle through callbacks surfaces as TS7022: implicitly has type 'any' because it is referenced directly or indirectly in its own initializer, which is a worse message than the ordering case and does not mention the fix. Reach for forward() when two nodes need each other's addresses.
Callbacks receive plain values: a port is a number and a hostname is a string, so template literals and JSON.stringify work as usual.
What goes in nodes
Only roots. Anything reachable through dependsOn, links or env is walked from there, so the example above lists api and gets db for free.
But a node that nothing reaches is an error, not an omission. defineConfig throws, naming any handle that is referenced but never registered — and any node that was constructed but is reachable from nothing:
alzo: `mailhog` was defined but nothing reaches it.
Add it to `nodes`, or reference it from a node that is already there.That second half is what keeps "only roots" honest. Add a service, forget to reference it, and under a plain roots rule nothing would happen and nothing would tell you. The case it catches most often is a start: 'manual' node — a seed task, a mail catcher — which by construction nothing depends on, and which would otherwise disappear from the graph silently.
More than one file
Alzo reads one entry file, alzo.config.ts. It can import your own helper modules and node factories; there is no configuration merge or include mechanism. Keep small graphs in one file for readable ordering. Imported code is executable configuration too. The config-change indicator watches only the entry file: after changing an imported helper, stop the environment and start it again to apply the change. See sharing a base stack across repositories.
Port-option typos and mistyped values are load errors naming the node and the field, even without a TypeScript check. alzo check adds the full type check; the first alzo up loads the file at run time without one, so run check before the first start.