Back to Rivet

Deploying to Cloudflare Workers

website/src/content/docs/deploy/cloudflare.mdx

2.3.21.5 KB
Original Source

This guide covers deploying an existing Rivet project to Cloudflare Workers.

Prerequisites

Steps

<Steps> <Step title="Set up your project">

Follow the Cloudflare Workers Quickstart to set up your project locally.

</Step> <Step title="Configure Wrangler">

Set your Rivet connection values as Worker variables. Find RIVET_ENDPOINT and RIVET_PUBLIC_ENDPOINT in the Rivet Dashboard under Settings → Namespace → Advanced → Backend Configuration and copy them in.

toml
name = "rivetkit-cloudflare"
main = "src/index.ts"
compatibility_date = "2025-04-01"
compatibility_flags = ["nodejs_compat"]

[vars]
RIVET_ENDPOINT = "https://your-namespace:[email protected]"
RIVET_PUBLIC_ENDPOINT = "https://[email protected]"
</Step> <Step title="Deploy">
sh
npx wrangler deploy
</Step> <Step title="Register the Serverless Runner URL">

After deploy, set the Worker URL with the /api/rivet path as the serverless runner URL in Rivet.

</Step> </Steps>