coloa

Implementation (as built)

Status 2026-11-29: the MVP stage of the roadmap is implemented, plus parts of v2/v3 (see “Beyond the MVP”), and tested end to end: the user journeys in 03-user-journeys.md run against real Postgres, Docker and WebAssembly. This page is the map from concept to code. It also lists where the build deviates from the concept docs, and why.

Quickstart

cargo build --release                        # Rust 1.89+; builds the JS guest for wasm32-wasip1
(cd console && npm install && npm run build) # optional: embeds the console UI (rebuild coloa after)
coloa init shop --template shop              # or react-ts / blank
cd shop && coloa dev                         # Postgres (Docker), functions, gateway :4100, console :4001
coloa agent connect claude-code              # agent gets its own identity over MCP
COLOA_ACTOR=agent:claude-code coloa deploy --preview pr-1
coloa promote pr-1                           # human only; snapshot first

Crates

Crate Role Docs section
coloa-audit Hash-chained JSONL audit log, file-locked appends, verification 02 (audit), 03 persona 2
coloa-config coloa.yaml (egress, secrets, budget, pricing; unknown sections preserved), secret store —
coloa-gateway Default-deny egress proxy: allowlist, DNS/SSRF filter, secret injection, leak blocking, response redaction, LLM token metering, budget enforcement 02, 04 §2, 05
coloa-sandbox Docker sandbox: internal network + one-port relay so the gateway is the only way out; secrets/policy/.git protected 04 §2 (microVM/Docker fallback)
coloa-meter Usage records, pricing, month-to-date totals across processes, caps, per-agent token budgets, cost reports 05
coloa-schema schema.coloa parser → Postgres tables + row-level security; migration planner 03 step 2, 04 §3
coloa-data Environment databases, coloa_app role, migrations, rule-enforced queries, sensitive-value taint, accounts, snapshots 04 §3
runtime-guest/ Boa JS engine compiled to wasm32-wasip1 + the function API prelude (db, fetch, Response, auth, env) 04 §2
coloa-runtime Wasmtime host: fresh instance per request, fuel/memory/time limits, single host-call import 04 §2
coloa-build TypeScript → JS (oxc), import resolution, routes, pre-deploy policy + cost checks 03 step 4, 05 §2
coloa-server App server, auth, environments/releases, deploy → promote → rollback, approvals, console API 03, 04
coloa CLI + MCP server for agents 03
console/ React console (embedded into the binary) 03 persona 2

schema.coloa in one screen

table tasks {
  owner    user @owner                 // set to the creator, can't be forged or changed
  project  ref(projects)               // foreign key; rules can follow it once
  title    text
  status   text @default("todo")
  assignee user @optional
  note     text @sensitive @optional   // never in default selects; masked in responses/logs
  index(project, status)

  allow read:   owner == auth.user || assignee == auth.user || auth.role == "manager"
  allow create: project.owner == auth.user
  allow update: owner == auth.user               // any editable column
  allow update(status): assignee == auth.user    // only these columns
  // no delete rule → nobody can delete
}

Types: uuid text int bigint float bool money timestamp date json user ref(t). Attributes: @primary @owner @sensitive @unique @index @optional @default(..). Conditions: == != < <= > >= in, && || !, auth.user, auth.role, auth.email, fields, one ref.field hop.

How each promise is kept

Promise Mechanism Proven by
Nothing public unless declared Tables get RLS + FORCE; coloa_app gets grants only for ops with allow rules; @owner forced to auth.user on create and immutable coloa-data/tests/postgres.rs (owner/other/staff/anon, raw SQL as coloa_app, forged owner)
Secrets never reach the browser or code @sensitive excluded from default selects; values read are tainted and masked in responses + logs; secrets are placeholders injected by the gateway e2e: masked response, logs, function sees placeholder only
Agents can’t touch prod agent:* actors can deploy previews only; promote/approve/rollback/egress/secret/budget changes are human-only and the refusal is audited; N-human rule for schema changes e2e: agent promote/rollback/egress denied; 2-person rule
Snapshot before every migration; one-click rollback pg_dump before each prod migration; rollback restores data + release pointer (and snapshots current state first) e2e: data after the snapshot disappears, earlier data intact
Default-deny egress, DNS control Gateway allowlist + own DNS + private/metadata address filter; Docker sandbox has no other route gateway tests, docker_sandbox.rs escape suite
Tamper-evident audit SHA-256 chain; verify in CLI and console audit unit tests, e2e tamper check
Hard budget caps, cost per request Every function invocation (fuel, DB queries), egress byte and LLM token is metered; caps enforced in gateway and server meter tests, gateway budget tests, e2e cost
Pre-deploy checks coloa check / deploy: sensitive reads, unknown tables/columns, ops without rules, egress outside allowlist, N+1 with cost estimate, module state coloa-build tests, e2e
Leave anytime coloa export: code, pg_dump per env, audit, releases, manifest e2e: archive contents, pg_restore -l

Decisions that differ from the concept docs

  1. No Postgres wire proxy (yet). Functions use a structured query API (db.from("orders").select(..).eq(..)); Coloa builds every SQL statement and Postgres RLS enforces the rules. Reason: if app code could send raw SQL on a shared session, it could spoof the session variables RLS relies on (set_config('coloa.user', …)). A wire proxy for Prisma/Drizzle needs a SQL parser that rejects such statements. It moves to v2 (see open questions).
  2. JS engine: Boa (pure Rust) instead of StarlingMonkey. No C/wasm toolchain needed, and it builds from cargo build. Trade-offs: slower than SpiderMonkey/QuickJS and some parser gaps. For example, export default async () => … is normalised by the transpiler. Measured ≈10 ms per invocation in a debug build, including instantiation. Benchmarking against StarlingMonkey/QuickJS stays an early spike.
  3. TypeScript is transpiled, not type-checked (oxc strips types). Type-checking stays in the developer’s editor/CI.
  4. Secrets in functions: the runtime sends https:// fetches to the gateway as http://, so the gateway can inject secrets and originate TLS itself. Raw CONNECT tunnels (sandboxed processes using https://) get allowlist + audit but no injection.
  5. Single-node control plane: state lives in .coloa/ JSON files with file locks plus Postgres. The 3-node Raft control plane is v2.
  6. npm packages in functions are not supported yet (relative imports and lib/ only). Bundling is a v2 item.

Tests

Suite Command Needs
Unit + integration cargo test --workspace —
Postgres rules COLOA_TEST_DOCKER=1 cargo test -p coloa-data --test postgres Docker
Sandbox escapes COLOA_TEST_DOCKER=1 cargo test -p coloa --test docker_sandbox Docker
S3 storage COLOA_TEST_DOCKER=1 cargo test -p coloa-storage --test s3 Docker (rclone serve s3)
Attack demo (typical stack vs Coloa) tests/attacks.sh [report.md] Docker, psql, python3
End to end (163 checks) cargo build -p coloa && tests/e2e.sh Docker, curl, python3
Multi-app server (97 checks) tests/e2e-server.sh Docker, curl, python3

Beyond the MVP (built)

Item (roadmap stage) Where Notes
Services mode, any language (v2) services: in coloa.yaml, coloa-server/src/services.rs, coloa-sandbox Containers on their own internal network, never the agent sandbox’s (coloa-<app>--services): read-only rootfs, no capabilities, memory/CPU limits, egress only via the gateway, one-port ingress relay; /svc/<name>/* with verified user headers, signed per service (see below)
Level 2 connectors (v2) connectors:, coloa-data/src/connector.rs, db.connector(name) Postgres only so far; read-only transactions, table allowlist, secret-scoped credentials, egress-checked host, every query audited
Spike/bot detection, per-IP limits (v2) protection:, coloa-server/src/traffic.rs Burst at N× the 10-min baseline limits the top sources for 10 min and audits traffic.spike
Per-team costs (v2) owners: (path prefix → team) Shown in coloa cost and the console
Pre-deploy cost check (v2) coloa check N+1 with monthly estimate
Cost advisor (v3) coloa cost advise Rule-based: N+1 rates, hot read endpoints, LLM spend, missing indexes (pg_stat), idle previews, forecast vs cap. No automatic PRs yet
White-label console (v3) console: { brand, color, tagline } Console name/colour only
App inventory (persona 2) console All projects initialised on the machine, with protection level
File storage (fixed decision: S3-compatible behind Coloa) files <name> { … } in schema.coloa, coloa-storage, coloa-server/src/files.rs The file’s row in Postgres carries the rules (checked as the user); the contents live in a local folder (.coloa/files/, dev default) or any S3-compatible service (COLOA_STORAGE=s3://bucket/prefix?endpoint=…, SigV4 implemented in Rust and verified against the AWS example and a real S3-compatible server). Size/type limits, sandboxed downloads, metering of transfer (per_gb_files_transfer) and of stored bytes over time (per_gb_month_files, sampled hourly), previews delete their files, export includes them
SSO for people (coloa server) org.yaml sso:, coloa-server/src/sso.rs OpenID Connect with PKCE; RS256 ID tokens checked against the provider’s keys; require_mfa checks amr; required makes managing apps (promote, approve, secrets, egress) SSO-only
Audit anchoring coloa audit anchor [--to URL], coloa-audit anchors, coloa-server/src/anchoring.rs The head (entry count + hash) is recorded outside the project ($COLOA_ANCHOR_DIR or ~/.coloa/anchors/) at start and every 10 min (COLOA_ANCHOR_INTERVAL); verify fails if an anchored entry is missing or changed (log cut back, deleted or rewritten). org.yaml audit_anchor_url POSTs every app’s new heads to an outside witness. coloa audit reset-anchors is human-only

Not built yet: cluster-wide rate limits (Valkey or Postgres counters), services on Kubernetes, the Kubernetes operator, multi-region with country pinning, a pre-booted CPython snapshot, Oracle/SQL Server/MySQL connectors, the Postgres wire proxy, npm bundling, monorepo ownership (agents_can_edit), and advisor-generated pull requests.

Many apps on one machine (coloa server)

# on the server (shared Postgres via COLOA_DATABASE_URL, or a managed container)
coloa server --listen 0.0.0.0:7700 --domain apps.company.vn
coloa server token lan                 # human token
coloa server token claude --agent      # agent token
coloa server grant an admin            # roles (see "Who may do what" below)
coloa server grant lan owner --app shop

# from a project
export COLOA_SERVER=http://apps.company.vn:7700 COLOA_TOKEN=…
coloa push --preview pr-1              # → http://pr-1.shop.apps.company.vn
coloa remote promote pr-1              # human token only → http://shop.apps.company.vn
coloa remote approve apr_0003 | reject | request-promotion | status | audit | apps
coloa remote egress api.stripe.com | secret STRIPE_KEY --host api.stripe.com   # humans

Several replicas (COLOA_CLUSTER_ADDR, crates/coloa-server/src/cluster.rs)

Any number of coloa server processes (pods, VMs) share one Postgres and one S3-compatible bucket. Every replica serves app traffic; one, the leader (whoever holds a Postgres advisory lock), makes every change. Turn it on with COLOA_CLUSTER_ADDR (how the other replicas reach this one, e.g. http://10.1.2.3:7700); a replica refuses to start without COLOA_DATABASE_URL, the same COLOA_MASTER_KEY everywhere, COLOA_STORAGE=s3://…, and (with scheduled backups) COLOA_BACKUP_KEY.

On AWS (shared Aurora PostgreSQL, S3, EC2)

CI/CD (.github/workflows/)

On Kubernetes (deploy/helm/coloa, Dockerfile)

coloa server with external Postgres, S3-compatible storage and an Ingress or a load balancer: one replica on a volume (default), or cluster.enabled for several replicas (above).

docker build -t registry.example/coloa:0.1.0 . && docker push registry.example/coloa:0.1.0
helm install coloa deploy/helm/coloa -n coloa --create-namespace \
  --set image.repository=registry.example/coloa --set image.tag=0.1.0 \
  --set domain=apps.example.com --set database.url=postgres://coloa:…@pg:5432/postgres \
  --set ingress.className=nginx --set ingress.tlsSecret=apps-wildcard-tls \
  --set storage.url='s3://files/coloa?endpoint=https://s3.example.com' --set storage.existingSecret=coloa-s3
kubectl -n coloa exec statefulset/coloa -- coloa server --home /data/server token minh   # first admin token

Services: checking who the user is

Coloa sends each request to a service with the signed-in user in x-coloa-user, x-coloa-role, x-coloa-email and x-coloa-env, plus x-coloa-signature: t=<unix seconds>,v1=<hex>. The signature is HMAC-SHA256, keyed with COLOA_IDENTITY_KEY (in the service’s environment, new on every start, different for every service), over these lines joined by \n:

v1
<t>
<method>
<path and query, as received>
<x-coloa-user>
<x-coloa-role>
<x-coloa-email>
<x-coloa-env>
<hex SHA-256 of the body>

Services that act on the user’s behalf should check it. Then nothing else can hand them a made-up user, not even another service of the same app, which shares their network but not their key. Accept a timestamp within 5 minutes and pass the path exactly as received.

Ready-made, dependency-free verifiers are in sdk/ (see sdk/README.md), all tested against one shared vector that the Rust signer must produce too:

# Python 3.8+: sdk/python/coloa_identity.py
from coloa_identity import verify
who = verify(self.command, self.path, self.headers, body)   # None if not from Coloa
// Go 1.21+: sdk/go/coloaidentity (net/http middleware; 401 for unsigned requests)
http.ListenAndServe(":"+os.Getenv("PORT"), coloaidentity.Middleware(handler))
who, _ := coloaidentity.FromContext(r.Context())
// Node 18+: sdk/node/coloa-identity.mjs
import { verify } from "./coloa-identity.mjs";
const who = verify(req, body);   // null if not from Coloa

tests/e2e-server.sh runs a Python service and a Go service (built with the Go SDK) under coloa server and checks both.

Service defaults

Setting Default Why
user the owner of the service’s dir, or 65534:65534 (nobody) when that’s root or there’s no dir; image keeps the image’s own an exploited service holds no root, and can still read its code
memory 512m, with no swap beyond it a leaking service is stopped, not left to slow the machine
cpus 1 one busy service can’t starve other apps on a shared server
filesystem read-only, /tmp in memory, code mounted read-only at /app  
network the app’s own services network; egress only through the gateway  

Services start independently: one that fails (its last output is in the warning and the audit log as service.start, outcome error) doesn’t stop the others. Pushed files keep their executable bit (and nothing else), so compiled binaries run.

Known limits