Openturn has three runtime classes. Every package is labelled in itsDocumentation Index
Fetch the complete documentation index at: https://openturn.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
package.json under openturn.runtime, and CI enforces the labels. Knowing them saves you from importing a Bun-only helper into a package that will one day run in a Cloudflare Worker.
The word “runtime” appears in two places in openturn and they mean different things:
package.json→openturn.runtime:"worker" | "browser" | "Bun"— the JavaScript host the package is allowed to run in. That is what this page is about.app/openturn.ts→metadata.runtime:"local" | "multiplayer"— whether the app runs entirely in the player’s browser or talks to a hosted server. Covered in local vs hosted.
The three runtimes
Worker — runs in Cloudflare Workers, Durable Objects, browsers, Node, Bun, or any modern ESM host. No Node builtins, no Bun globals, noBuffer, no filesystem. All authoritative game logic and protocol code is worker-safe.
Browser — runs in a modern browser. Can use DOM, window, React. Must not import Node/Bun APIs.
Bun — runs locally with Bun. Can use Bun APIs, node:* modules, and the filesystem. Reserved for tooling: CLIs, dev servers, build pipelines, scripts.
Current mapping
| Package | Runtime |
|---|---|
@openturn/core | worker |
@openturn/json | worker |
@openturn/gamekit | worker |
@openturn/protocol | worker |
@openturn/replay | worker |
@openturn/server | worker |
@openturn/client | worker |
@openturn/react | browser |
@openturn/bridge | browser |
@openturn/inspector | browser |
@openturn/inspector-ui | browser |
@openturn/deploy | Bun |
@openturn/cli | Bun |
examples/*/game | worker |
examples/*/app | browser |
examples/*/cli | Bun |
Why worker-safe by default
The authoritative runtime (the one that decides what actually happened) has to work in Cloudflare Durable Objects, because that is where hosted matches run. Everything upstream of that (game definition, reducer, protocol, replay) has to be the same code locally as in production. If it importsfs or Buffer, it cannot.
This is also why G, events, and views are JSON-only. JSON is the lingua franca of “things that survive structured-clone to a Durable Object.”
Writing your own package
If you build a new package, declare its runtime in thepackage.json:
tsconfig (tsconfig.worker.json, tsconfig.browser.json, or tsconfig.bun.json) so the language service refuses Node/Bun APIs in worker packages.
If a package mixes worker logic with Bun-only tooling, split it. Cutover is preferred over compatibility shims.
What to read next
- Local vs hosted architecture for how worker and browser packages fit together in a real app.
- Reference: packages overview for the per-package index.