A 1.2 MB pure-Rust rewrite of headless Blender built for AI agents — 3D B-rep modeling engine, CLI, and MCP server
How to deploy Forma (HTTP, Docker, Cloud, and Sandboxes)
Use this guide to run Forma as a headless HTTP microservice (forma-server), deploy the FROM scratch container to cloud providers (AWS, Cloudflare Containers, Google Cloud Run, Fly.io), or package static Linux musl binaries for AWS Lambda and air-gapped sandboxes.
forma-server is excluded from Cargo's default-members so core CLI/MCP builds stay minimal. It disables host filesystem access (allow_fs_import = false), caps script size (max_statements = 1024), enforces a 16 MiB body limit, and processes jobs across a bounded worker pool.
Option A: Build and run forma-server natively with Cargo
Build with --profile static-release (full LTO, single codegen unit, stripped symbols) or --release:
cargo build --profile static-release -p forma-server
./target/static-release/forma-server --bind 127.0.0.1:8080 --workers 4
You can also configure bind address and worker count through environment variables:
FORMA_BIND=0.0.0.0:8080 FORMA_WORKERS=4 ./target/static-release/forma-server
Verify the server is live:
curl -s http://127.0.0.1:8080/health
Expected response:
{"status":"ok","version":"0.4.5","workers":4}
Option B: Deploy the FROM scratch Docker image (AWS, Cloudflare, Cloud Run, Fly.io)
The repository Dockerfile builds static musl binaries (forma-server and forma using --profile static-release) and copies them into FROM scratch (< 5 MB final image) with FORMA_BIND=0.0.0.0:8080 and port 8080 exposed:
docker build -t forma-server:0.4.5 .
docker run --rm -p 8080:8080 -e FORMA_WORKERS=4 forma-server:0.4.5
Because the container requires zero GPU and ~15 MB RAM, it deploys directly to AWS ECS/Fargate/App Runner, Cloudflare Containers, Google Cloud Run, Azure Container Apps, Fly.io, Railway, and Render.
Option C: Static Linux binaries & offline sandboxes (AWS Lambda, ChatGPT VM)
GitHub Releases (.github/workflows/server-release.yml) publish static +crt-static Linux musl binaries for both x86_64 and aarch64 (AWS Lambda Graviton):
forma-linux-{x86_64,aarch64}-musl.tar.gz— standaloneformaCLIforma-server-linux-{x86_64,aarch64}-musl.tar.gz— standaloneforma-serverHTTP workerforma-sandbox-linux-{x86_64,aarch64}.zip— single-file offline kit (forma+sandbox/forma.py+SKILL.md)
For AWS Lambda:
- Node.js runtime:
npm install forma-3d(architecture-independent WASM, fits a 128 MB Lambda). - Python runtime: bundle
forma-sandbox-linux-{x86_64,aarch64}.zip(or placeformain a Lambda Layer at/opt/bin/forma) andimport forma. - Container / Custom runtime: deploy
Dockerfilewith AWS Lambda Web Adapter (AWS_LWA_PORT=8080).
For agent VMs (boat.dev, Modal, E2B, Daytona, Colab): run npx -y forma-3d, cargo build --release, or the static musl tarball directly.
Evaluate a script and receive a binary mesh or render
Send POST /v1/eval with format set to "glb", "obj", "stl", "3mf", "step", "png", or "svg" to receive binary output plus X-Forma-* invariant headers:
curl -sS -D - http://127.0.0.1:8080/v1/eval \
-H 'Content-Type: application/json' \
-d '{
"code": "p = box(40, 20, 6) | cut(cyl(5, 10)) | bevel(vertical, 1.5)",
"unit": "mm",
"strict": true,
"format": "glb"
}' \
-o bracket.glb
Inspect the response headers for geometry telemetry:
X-Forma-Exec-Ms: server-side execution time in milliseconds.X-Forma-Watertight:trueorfalse.X-Forma-NonManifold: count of non-manifold edges.X-Forma-Verts/X-Forma-Faces: output vertex and face counts.
Set "format": "json" (the default) when you want ok, elapsed_ms, text, parts, diff, and warnings, or "format": "text" for plain-text observations.
Pass external meshes safely without host disk access
Because forma-server sets allow_fs_import = false, load("...") only reads keys supplied in the request's assets base64 map:
MESH_B64=$(base64 < input.glb | tr -d '\n')
curl -sS http://127.0.0.1:8080/v1/eval \
-H 'Content-Type: application/json' \
-d "{
\"code\": \"p = load(\\\"input.glb\\\") | decimate(ratio=0.5)\",
\"format\": \"glb\",
\"assets\": { \"input.glb\": \"$MESH_B64\" }
}" \
-o lod.glb
For single-asset cleanup without writing a script, call POST /v1/process:
curl -sS http://127.0.0.1:8080/v1/process \
-H 'Content-Type: application/json' \
-d "{
\"asset_base64\": \"$MESH_B64\",
\"input_format\": \"glb\",
\"output_format\": \"glb\",
\"yup\": true,
\"center_z0\": true,
\"decimate\": 0.5
}" \
-o cleaned.glb
Handle concurrency and backpressure in production
- Worker count defaults to
available_parallelism().clamp(1, 8)and can be tuned up to64via--workersorFORMA_WORKERS. - The request queue is bounded to
workers * 8pending jobs. When saturated,forma-serverimmediately returns503 Service Unavailablewith JSON error"worker queue saturated"so an upstream load balancer can shed load or retry. - Do not send
Transfer-Encoding: chunkedrequests;forma-serverrequiresContent-Lengthand returns501 Not Implementedfor chunked bodies. - Place
forma-serverbehind a TLS-terminating reverse proxy (such as Caddy, nginx, or Envoy) when exposing it beyond loopback.