Fastly Compute
Fastly Compute (JavaScript) still uses the fetch event listener model rather than the modules-style default export you see on Cloudflare Workers. The DaloyJS adapter wraps that registration so you only call one function.
When to choose Fastly Compute
- You already use Fastly's edge network and want REST API logic on the same plane.
- You want WebAssembly-compiled JS (
js-compute-runtime) for tight cold starts. - You're comfortable without
node:*modules.
Install
Entrypoint
Under the hood that's equivalent to:
fastly.toml
Fastly Compute requires manifest_version = 3. The [scripts] build command has to bundle TypeScript to a single JS file first, then run js-compute-runtimeagainst that bundle — the runtime only accepts JavaScript input.
Declared backends, KV stores, config stores, and secrets live under the same [local_server.*] / [setup.*]tables — see the fastly.toml reference for the full schema.
Deploy
Gotchas
- No
node:*modules. Avoid the Node session store, the Redis rate-limit store, and multipart helpers that depend onnode:stream— use the fetch-based alternatives. - Every outbound HTTP call your REST API makes (to a database API, auth service, or third-party endpoint) must be declared as a backend in
fastly.toml. Arbitraryfetch("https://...")calls fail at runtime without one. - KV stores, config stores, and secrets are also declared in
fastly.tomlunder[setup].
See also
- Adapters overview
- Cloudflare Workers — similar constraints, modules format.