Runtimes
Run the same Flare graph on Node.js, Cloudflare Workers, and Durable Objects with runtime adapters.
Flare runs one validated graph on more than one runtime. Register config, services, and arcs once, pass a runtime adapter to new FlareHost(adapter), and host.build() returns an app with the entrypoint that runtime expects.
| Runtime | Adapter | Import | Entrypoint |
|---|---|---|---|
| Node.js (22+) | node | @flare-ts/core/node | app.run() |
| Cloudflare Workers | cf, buildCf | @flare-ts/core/cloudflare | app.export() |
| Bun | bun | @flare-ts/core/bun | Stub: build() throws |
| Deno | deno | @flare-ts/core/deno | Stub: build() throws |
The registrations never change. You swap the adapter, and the entrypoint changes with it. See Host for adapters, lifecycle, and WorkerExportedHandle.
Maintaining that by hand means either two codebases that drift apart, or one codebase with a platform check around every difference, and the checks only cover the differences someone remembered: a feature that silently does nothing on one target ships without complaint. Here the adapter sets the host’s type, so a capability a runtime lacks is an absence you cannot reference (host.singleton does not exist on a Cloudflare host; host.durableObject exists only there), and reaching for the wrong one is a TypeScript error in the registration file, not a deploy-time surprise.
Node.js
Section titled “Node.js”- Overview: The node adapter, flare.json, and when to call app.run().
- Run and shutdown: NodeRunHandle, graceful drain, and readiness probes.
Cloudflare Workers
Section titled “Cloudflare Workers”- Overview: cf adapter, export default app.export(), and Workers constraints.
- Deploy: wrangler.toml, nodejs_compat, and buildCf for bundled config.
- Bindings and services: Bindings and DurableState services for env and storage.
- Log context on Workers: captureLogStore and runWithLogStore for waitUntil work.
- Durable Objects: FlareDurableObject, per-instance arcs, mount, and testing.
Other runtimes
Section titled “Other runtimes”- Bun and Deno: Reserved adapters; not runnable in 0.3 yet.