Cloudflare
Copy page
Deploy Nizhal on Cloudflare Workers with Durable Objects as the realtime hub.
import { createNizhalWorkerFetchHandler } from "@nizhal/server/adapters/cloudflare";import { cloudflareRealtime } from "@nizhal/server/adapters/cloudflare";
export default createNizhalWorkerFetchHandler({ db: env.HYPERDRIVE.connectionString, schema, mutators, syncRules, auth, realtime: cloudflareRealtime({ env }),});Export NizhalBucket (PartyServer Server subclass) in wrangler.toml as a Durable Object binding.
Client
Section titled “Client”import { createCloudflareSubscribeSource } from "@nizhal/db-collection";// or createNizhalNitroClient on mobilePartySocket reconnect semantics match the in-process WS server.
Caveats
Section titled “Caveats”- Durable Object outbound connections idle ~15 minutes — fine for ping-and-repull; clients reconnect; cursor pull catches up
- Storage remains Postgres (often via Hyperdrive to Neon/RDS) — DO is realtime only, not the system of record
Smoke test
Section titled “Smoke test”packages/server/examples/run-cf-e2e.sh and cf-e2e-smoke.ts exercise the Workers path.