Skip to main content
Platforms

Cloudflare Workers

Run Rivet workers on Cloudflare Workers.

Cloudflare Workers is a serverless platform: there is no long-lived process, so the control plane calls your /api/rivet endpoint to start actors. The Worker URL has to be public and registered.

Requirements

Steps

Configure wrangler

nodejs_compat is required.

name = "rivet-worker"
main = "src/index.ts"
compatibility_date = "2025-04-01"
compatibility_flags = ["nodejs_compat"]

[vars]
RIVET_ENDPOINT = "https://your-namespace:sk_...@api.rivet.dev"
RIVET_PUBLIC_ENDPOINT = "https://your-namespace@api.rivet.dev"

Both values are described in Workers. For a production deployment, set RIVET_ENDPOINT with wrangler secret put rather than committing it in [vars].

Deploy

npx wrangler deploy

Register the URL

Set the Worker URL with the /api/rivet path as the serverless runner URL in the dashboard.

Scaling

Cloudflare autoscales Workers for you: there are no instances or replicas to configure. The one scaling bound you own is maxConcurrentActors on the serverless runner config, which caps concurrent actors across the whole pool and defaults to 1000. See the production checklist.

Next steps