Self-hosting
The Zäm server is free to run on your own infrastructure. It ships as a container image and a Helm chart; the source stays closed, the releases are public.
What runs where
| Component | Role |
|---|---|
| zaem-server | The API, WebSockets, device sign-in and the web console. Stateless; run one or several. |
| PostgreSQL | Organizations, people, devices, audit log, daily usage. Small and rarely written. |
| ScyllaDB (or Cassandra) | The encrypted session logs, locks and live counters: everything on the hot path. |
| NATS (JetStream) | Pushes changes between server instances. Optional with a single instance. |
| S3-compatible storage | Encrypted code checkpoints. Optional: without it, checkpoints are off. |
Your identity provider
People sign in with OpenID Connect. Register an app (a "web application" / confidential client) in your provider and allow this redirect address:
https://<your-zaem-address>/auth/callbackThen give the server the organization and the app's details on first start. When ZAEM_BOOTSTRAP_ORG_NAME is set, the server creates the organization if it does not exist yet; it never changes an existing one. The first person to sign in becomes its owner.
| Variable | Meaning |
|---|---|
ZAEM_BOOTSTRAP_ORG_NAME | Your organization's name. Setting it turns the first-start setup on. |
ZAEM_BOOTSTRAP_ORG_SLUG | Optional short name (lowercase letters, digits, dashes); derived from the name otherwise. |
ZAEM_BOOTSTRAP_OIDC_ISSUER | Issuer URL of your identity provider, e.g. https://accounts.google.com. |
ZAEM_BOOTSTRAP_OIDC_CLIENT_ID | Client id of the app you registered there. |
ZAEM_BOOTSTRAP_OIDC_CLIENT_SECRET | Its client secret. Read from the environment at sign-in; never stored in the database. |
ZAEM_BOOTSTRAP_EMAIL_DOMAINS | Comma-separated email domains that sign in to this organization (empty: anyone the provider signs in). |
Railway (one click)
The Railway template deploys the full stack on Railway's private network: zaem-server, PostgreSQL, ScyllaDB, NATS and a Railway storage bucket for code checkpoints.
- Register an OpenID Connect web app at your identity provider (you add its redirect address after the deploy).
- Click Deploy on Railway and fill in the five
ZAEM_BOOTSTRAP_*variables (above). Everything else is prefilled: database URLs, a generated token secret, the public address. - Deploy. The first start takes a few minutes while ScyllaDB starts; the server waits for it.
- Add
https://<your-railway-domain>/auth/callbackas a redirect address in your identity provider, open the address and sign in. You are the owner.
Plan for about 2–3 GB of memory in total (ScyllaDB uses about 1.5 GB), billed by Railway by usage. For large teams or several server instances, run it on Kubernetes.
Docker
Run the image next to your own PostgreSQL, ScyllaDB, NATS and S3 (managed services work too):
docker run -d --name zaem -p 8740:8740 \
-e ZAEM_LISTEN=0.0.0.0:8740 \
-e ZAEM_PUBLIC_URL=https://zaem.example.com \
-e ZAEM_TOKEN_SECRET="$(openssl rand -base64 32)" \
-e ZAEM_CONTROL=postgres -e ZAEM_DATABASE_URL=postgres://zaem:…@postgres:5432/zaem \
-e ZAEM_STORE=scylla -e ZAEM_SCYLLA_NODES=scylla:9042 -e ZAEM_SCYLLA_CREATE_KEYSPACE_RF=1 \
-e ZAEM_BUS=nats -e ZAEM_NATS_URL=nats://nats:4222 \
-e ZAEM_BLOBS=s3 -e ZAEM_S3_BUCKET=zaem-checkpoints -e ZAEM_S3_REGION=eu-central-1 \
-e AWS_ACCESS_KEY_ID=… -e AWS_SECRET_ACCESS_KEY=… \
-e ZAEM_BOOTSTRAP_ORG_NAME="Acme" \
-e ZAEM_BOOTSTRAP_OIDC_ISSUER=https://accounts.google.com \
-e ZAEM_BOOTSTRAP_OIDC_CLIENT_ID=… -e ZAEM_BOOTSTRAP_OIDC_CLIENT_SECRET=… \
-e ZAEM_BOOTSTRAP_EMAIL_DOMAINS=acme.com \
ghcr.io/zaem-ai/zaem-server:latestPut it behind HTTPS (a reverse proxy or load balancer that supports WebSockets) and set ZAEM_PUBLIC_URL to that address. Keep ZAEM_TOKEN_SECRET stable across restarts and the same on every instance. Health checks: /healthz (alive) and /readyz (backends reachable).
Settings
| Variable | Meaning |
|---|---|
ZAEM_PUBLIC_URL | The address people and devices use (sign-in redirects, device tokens). |
ZAEM_TOKEN_SECRET | Base64, at least 32 bytes. Signs access tokens. |
ZAEM_LISTEN | Address to listen on, e.g. 0.0.0.0:8740. |
ZAEM_CONTROL, ZAEM_DATABASE_URL | postgres and its connection URL. |
ZAEM_STORE, ZAEM_SCYLLA_NODES | scylla and its contact points. ZAEM_SCYLLA_CREATE_KEYSPACE_RF creates the keyspace with that replication factor. |
ZAEM_BUS, ZAEM_NATS_URL | nats for several instances; memory for one. |
ZAEM_BLOBS, ZAEM_S3_* | s3 (bucket, endpoint, region; credentials as AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY), local (a volume) or none. |
ZAEM_RETENTION_DAYS | Default for deleting inactive sessions (organizations can set their own). |
ZAEM_METRICS_LISTEN | Prometheus metrics on a separate, internal address. |
OTEL_EXPORTER_OTLP_ENDPOINT | Send OpenTelemetry traces to a collector. |
ZAEM_LOG_FORMAT | json for log collectors. |
Kubernetes (Helm)
The chart runs zaem-server with readiness checks, Prometheus metrics, graceful rollouts (sessions reconnect at once) and optional autoscaling. Bring PostgreSQL, ScyllaDB, NATS and S3 (operators or managed services).
helm install zaem oci://ghcr.io/zaem-ai/charts/zaem --version <version> -f values.yamlpublicUrl: https://zaem.example.com
tokenSecret:
name: zaem-token # Secret with key `secret`
control:
databaseUrlSecret:
name: zaem-postgres # Secret with key `url`
store:
scyllaNodes: [scylla-client.scylla:9042]
bus:
natsUrl: nats://nats.nats:4222
bootstrap: # first-start organization (optional)
orgName: Acme
oidcIssuer: https://accounts.google.com
oidcClientId: …
emailDomains: acme.com
clientSecret:
name: zaem-oidc # Secret with key `client-secret`Create the referenced Secrets first. publicUrl, the database and token Secrets and store.scyllaNodes are required; the chart refuses to render without them. See the chart's values.yaml for checkpoints (S3), ingress, metrics and autoscaling. The chart does not install PostgreSQL, ScyllaDB or NATS.
Upgrades and backups
- Database migrations run on start. Roll out new versions one instance at a time; open sessions reconnect.
- Back up PostgreSQL and ScyllaDB as usual (and version your bucket). All session data in them is ciphertext.