pkg:clod/com.clodhub/server-host 0.13.0 Server entry point for a server target: one worker module that runs on Cloudflare Workers or, through a Node http adapter, on the owner's own hardware, with origin policy, region placement and deployment files rendered from typed settings. The entry point of a server target. The application writes one worker module (a default-exported entry built from the room service, and the Room and Directory object classes). This component validates the server settings, puts the origin policy and region placement in front of that entry, and renders what is needed to run it: a Wrangler project and deploy script for Cloudflare Workers, or a start script for the Node adapter, which runs the same module on Node's http server for own hardware. The Node adapter supplies the pieces of the Workers runtime the room service uses: named single-instance objects with disk storage and alarms, hibernating WebSockets with automatic ping replies, and the WebSocketPair and WebSocketRequestResponsePair globals. Examples A small table uses cloudflare-free and stays within the free request allowance; a larger or always-on service uses cloudflare-paid; a club that prefers its own machine uses own-hardware and keeps data in a folder it can back up. A server pinned to `eu` keeps its objects in the European Union jurisdiction on Cloudflare. Package URL: pkg:clod/com.clodhub/server-host@0.13.0 Class: Server host (pkg:clod/com.clodhub/server-host-class@1.1.0): Runs the application's server on Cloudflare Workers or on Node on your own hardware. Any component of this class can fill a recipe slot that asks for it. Category devices-and-hosts/server; https://clodhub.com/classes/server-host-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Fserver-host-class Provides (1) - server-host (com.clodhub/server-host 1.0.0): Server host for the room service (TypeScript modules server/host.ts and server/node/*.ts). The application writes one worker module that default-exports an entry and exports its Durable Object classes; Cloudflare runs it as it is (providers cloudflare-free and cloudflare-paid, files wrangler.jsonc, deploy.sh, package.json), and serveNode runs the same exports on Node's http server (provider own-hardware, files start.ts, package.json; import node/register.ts before any module written for Workers). The room service entry comes from realtime-rooms createWorker and the Directory class from room-directory createDirectoryClass; the host wraps them, it does not replace them. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Fserver-host Requires (2) - room-session (com.clodhub/room-session 1.0.0): Persistent private game rooms on Cloudflare Durable Objects and the clients that reach them. Server: createRoomClass and createWorker (server/index.ts, server/worker.ts; constants POLL_MS 25000, MAX_DISPLAYS 6, DISPLAY_IDLE_MS 3600000, LIVE_MS 75000). Clients: Live (web/live.ts), LiveConnection (Swift), RoomTransport (Kotlin). The HTTP routes are in interfaces/room-session-http.json (OpenAPI 3.1.1) and the live messages in interfaces/room-session-live.json (AsyncAPI 3.1.0). The directory object is not provided here: rooms call the DIRECTORY namespace, which the application binds to room-directory's createDirectoryClass. components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Froom-session - room-directory (com.clodhub/room-directory 1.0.0): One summary of every room for the home screens. Pure list operations (server/directory-core.ts; the same rules in Swift as static functions of enum RoomDirectory and in Kotlin as top-level functions of package com.clodhub.directory), the Directory Durable Object class (server/directory.ts, platform base class injected), the ndjson export and import of its stored list (server/directory-migration.ts) and the web watcher (web/directory-client.ts). Methods are tagged with the languages that provide them. The object's requests are in interfaces/room-directory-http.json (OpenAPI 3.1.1) and its live list in interfaces/room-directory-live.json (AsyncAPI 3.1.0). components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Froom-directory Settings (5) The installer collects `provider` (`cloudflare-free`, `cloudflare-paid` or `own-hardware`), `accountReference` (a reference name, never a value: the name of the secret in the release pipeline's store that holds the Cloudflare account; default `none`, which is right on own hardware and refused on Cloudflare), `allowedOrigins` (one web address of the client; default `http://localhost:5173`; loopback addresses are trusted anyway, and more origins are passed to `createServerHost` as a list), `roomPrefix` (required; lower-case letters, digits and hyphens, such as `ourpoker-`: the prefix of the names under which rooms are stored, also used for the worker's name and for video room names) and `region` (default `any`; on Cloudflare a jurisdiction `eu`, `us` or `fedramp`, or a location hint such as `weur`; on own hardware a free label only). clod renders all five into `host-settings.ts` at install. - provider: string (slug); required, no default - accountReference: string (slug); optional, default "none" - allowedOrigins: string (address); optional, default "http://localhost:5173" - roomPrefix: string (slug); required, no default - region: string (slug); optional, default "any" Depends on components: none How to use in a recipe A recipe uses it through a slot of class Server host (pkg:clod/com.clodhub/server-host-class 1.1.0), naming pkg:clod/com.clodhub/server-host as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (server-host) to the slots that use it. It fills what the component needs (room-session and room-directory) from slots whose components provide them. The recipe sets provider, accountReference, allowedOrigins, roomPrefix and region; provider and roomPrefix have no default, so the recipe always sets them. - as a slot in recipe.json components: {"id":"server-host","class":{"name":"pkg:clod/com.clodhub/server-host-class","version":"1.1.0","digest":"9051566d360fcaa7cb61b35953f09b0d1a0417bda38ddd8b835cc28a495468aa"},"preferred":{"name":"pkg:clod/com.clodhub/server-host","version":"0.13.0"}} - in place of another component of the class: clod fetch server-host@0.13.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=server-host@0.13.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot server-host) For developers: how an application uses it clod renders `components/server-host/server/host-settings.ts` from the five settings (a template artefact; nothing else writes it). It exports `hostSettings` (the typed values) and `serverSettings()` (the settings `createServerHost` takes; `none` for `accountReference` means no account). In the application's server module: `import { serverSettings } from "./host-settings.ts"` and `const host = createServerHost(serverSettings())` (or `createServerHostFromHostSettings(hostSettings)`) from `server/host.ts`; build the room service as usual (`createWorker(host.roomsSettings(), roomIds, service)`); `export const Room = host.objectClass(RoomBase)` and `export const Directory = host.objectClass(DirectoryBase)` (`DirectoryBase = createDirectoryClass(DurableObject, options)` from room-directory); `export default host.entry(worker)`. The installed application runs the module with the two installed files beside `host-settings.ts`, which assume the application's worker module is `server/src/index.ts` (the Durable Object classes `Room` and `Directory`, bindings `ROOM` and `DIRECTORY`): `wrangler.jsonc`, rendered at install from the settings (the worker named `server`, `nodejs_compat`, `WEB_ORIGINS` from `allowedOrigins`, the two SQLite-backed objects; the same configuration `renderWrangler` writes), used from the application's server folder as `wrangler deploy --config ../components/server-host/server/wrangler.jsonc` (or `wrangler dev`, or the Workers test runtime); and `start.ts`, run as `node ../components/server-host/server/start.ts` on Node for own hardware or local development with any provider: it imports `server/node/register.ts` before the application module, passes `WEB_ORIGINS` (default `allowedOrigins`), `CODE_VERSION` and every other upper-case environment variable to the worker's env, and listens on `PORT` (default 8788) and `HOST` (default 127.0.0.1) with room storage in `DATA_DIRECTORY` (default `./data`). `host.deployFiles()` renders the same deployment files from settings at run time for an application laid out differently; write them next to the module. Cloudflare providers: write them, then run `sh deploy.sh` with the secret reference resolved into `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN`. Own hardware: write `start.ts`, run `node start.ts`; it imports `server/node/register.ts` before the application module (a registered loader maps `cloudflare:workers` to a local shim and extensionless relative imports to `.ts`), then calls `serveNode`. `examples/worker.ts` composes the host with a small room service, `examples/start-own-hardware.ts` runs it, and `examples/rendered-host-settings.ts` is what clod renders for one set of answers. `server/node/storage-export.ts` exports and imports the Node adapter's data as ndjson (see migration.json). Accounts and services cloudflare-free and cloudflare-paid deploy one Worker with SQLite-backed Durable Objects (the only kind the free plan offers) to a Cloudflare account supplied by reference; nothing in the package holds an account value, and `wrangler.jsonc` carries only a comment naming the reference. own-hardware needs one machine with Node 26 or later, a port, and TLS in front if clients connect from https pages (the adapter speaks plain http and ws). Limits and prices are in suitability.json with their sources; the Node adapter has no measured limits. How it is checked `node --test tests/web.test.ts` checks settings validation (every provider, account reference grammar, origins, regions), the `host-settings.ts` template rendered by a small pure renderer that mirrors clod's `{{setting}}` rules (quoted positions, grammars, secret settings refused, defaults) and then loaded and handed to the host, the origin policy and region placement against fake namespaces, the rendered deployment files, the installed `wrangler.jsonc` against `renderWrangler`, `start.ts` serving a worker module laid out as an installed application (on a free port, with `DATA_DIRECTORY`), RFC 6455 framing, and the Node adapter end to end on a real socket with a small Workers-style service: HTTP routing to named objects, object-to-object calls, streamed bodies, WebSocket handshake, first message, auto ping reply, broadcast, binary frames, server and client close, protocol errors, alarms, abort and restart, persistence across a restart including a pending alarm, and storage export and import. `authoring/integration-realtime-rooms.ts` (not packaged) additionally runs the real realtime-rooms service on the Node adapter. Deployment to Cloudflare, the wrangler files against a real account, and TLS, load and long-running behaviour of the Node adapter were not exercised. - `node --test tests/web.test.ts` (web, required-local; tools: node 26.5) Updates Patch updates replace the owned files; render the deployment files again after each update. The Node adapter's data format is described in migration.json (`com.clodhub/object-storage` 1.0.0). `accountReference` is a non-secret reference name with default `none` (a template cannot render a secret setting) and `allowedOrigins` has the default `http://localhost:5173`. `ServerSettings` is the lower layer that `createServerHost` takes; `serverSettings()` builds it from the rendered `hostSettings`. The Directory class comes from room-directory. Removal deletes the owned sources; on Cloudflare the Worker and its objects remain in the account until the owner deletes them, and on own hardware the data folder remains until the owner deletes it (export it first). Tags: devices-and-hosts, host, server Targets: client none; server hosting-provider, own-hardware Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/server-host release v0.13.0; digest sha256:8bd11bb36f7a61740a96b383637f3bba9a828e0570fc0063712c974389cfe528 Release: features Line 0.13: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/server-host/0.13.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/server-host/0.13.0 Bundle download: GET https://clodhub.com/api/components/server-host/0.13.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/server-host-class@1.1.0 9051566d360fcaa7cb61b35953f09b0d1a0417bda38ddd8b835cc28a495468aa com.clodhub/server-host 1.0.0 entry modules: server server/index.ts shared behaviour suites: shared Platforms: server Toolchains: node >=26.5.0 <27.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 46 files (listed on the details page) Suitable for jobs: server-host profile cloudflare-free: cost free; load requestsPerDay 100000, storedMegabytes 5000; regions any, eu, us, fedramp; compliance none; Cloudflare Workers with SQLite-backed Durable Objects Workers Free profile cloudflare-paid: cost metered; load none; regions any, eu, us, fedramp; compliance none; Cloudflare Workers with SQLite-backed Durable Objects Workers Paid profile own-hardware: cost none; load none; regions any; compliance none; Node http server on the owner's machine own hardware Notes: Limits and prices for the two Cloudflare profiles come only from developers.cloudflare.com pages fetched on 2026-11-09: workers/platform/limits, workers/platform/pricing, durable-objects/platform/limits, durable-objects/platform/pricing, durable-objects/reference/data-location. The own-hardware profile cites no source. Data migration: stores objects (com.clodhub/object-storage 1.0.0); formats ndjson; requires stop no; retention 30 days Maintainers: Level N Ltd; https://github.com/clodhub/server-host/issues; updates https://github.com/clodhub/server-host/releases (manual) What you download server-host-0.13.0.tar, from release v0.13.0 of clodhub/server-host: 46 files - Documents and manifests (9): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (17): server/ (17) - Tests (4): fixtures/ (2), render-template.ts, web.test.ts - Interface documents (4): object-storage.schema.json, required-room-directory.json, required-room-session.json, server-host.json - Class files: the class's interfaces and shared checks (3): server-host-class/ (3) - Examples (4): rendered-host-settings.ts, service.ts, start-own-hardware.ts, worker.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 17 of them into the application under components/server-host/: server 17 Not included: the components that provide what it requires (com.clodhub/room-session, com.clodhub/room-directory), each a separate download; the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.13.0 features (2026-11-26T11:32:13.317Z) sha256:8bd11bb36f7a61740a96b383637f3bba9a828e0570fc0063712c974389cfe528 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/server-host/details.txt?version=0.13.0 Page: https://clodhub.com/components/server-host; JSON: https://clodhub.com/api/components/server-host/0.13.0; connections diagram: https://clodhub.com/api/components/server-host/0.13.0/connections.svg Copyright Level N Ltd 2026