W
Platform

Edge Workers

Run user-defined JS at the edge — Node-isolate sandbox or a safe-template DSL.

How it works

Two runtimes share the same routing layer. (1) The **Node-isolate sandbox** spawns a Node subprocess via Port with strict resource caps (max heap, max CPU ms, no net/fs by default); the worker code is evaluated in a fresh V8 isolate per request. (2) The **safe template DSL** is a pure-Elixir interpreter for `status:`, `header:`, `body:`, `{{vars}}`, and `if/end` — no JS, no syntax errors crashing the host. Both runtimes attach OTel spans to the request automatically.

What this lets you do

  • Serve customer-defined logic without giving them a server
  • Sandbox the dangerous stuff: safe-template handles 95% of needs
  • Per-invocation metrics + traces — workers observe themselves
  • VS Code-style editor in the dashboard for live edits

Get it running

  1. 1 Open `Workers` → `+ New worker`, pick runtime (`js` or `safe`)
  2. 2 Edit code in the VS Code-style editor; save deploys instantly
  3. 3 Hit your worker at `https://YOUR-FUNNEL/w/<worker-id>`

Code examples

# workers/hello-template
status: 200
header: Content-Type: application/json
body: {
  "hello": "{{ request.query.name | default: "world" }}",
  "ts":    "{{ now }}"
}
Where to find it
/app/p/:org/:project/workers
Open in app →