Skip to content

Runtimes

Run the same Flare graph on Node.js, Cloudflare Workers, and Durable Objects with runtime adapters.

AI generated, pending review Updated 10 days ago · Flare 0.3

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.

RuntimeAdapterImportEntrypoint
Node.js (22+)node@flare-ts/core/nodeapp.run()
Cloudflare Workerscf, buildCf@flare-ts/core/cloudflareapp.export()
Bunbun@flare-ts/core/bunStub: build() throws
Denodeno@flare-ts/core/denoStub: 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.

  • Overview: The node adapter, flare.json, and when to call app.run().
  • Run and shutdown: NodeRunHandle, graceful drain, and readiness probes.
  • 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.