Deploy to Cloudflare
Deploy the Cloudflare Worker after Modal is ready. The Worker is the public URL your app calls.
Before You Deploy
- Node.js 20+
- a Cloudflare account
wrangler login- the Modal backend already running or deployed
- the Modal URL ready for
MODAL_API_BASE_URL
Install the Worker package first:
cd edge-control-plane
npm install
wrangler login
Required Secrets
Upload the shared secrets to the Worker:
wrangler secret put INTERNAL_AUTH_SECRET
wrangler secret put SESSION_SIGNING_SECRET
Important:
INTERNAL_AUTH_SECRETmust match Modalinternal-auth-secret.SESSION_SIGNING_SECRETis used to mint session tokens for your app.
Required Bindings
The canonical Worker needs:
SESSION_CACHEKVMODAL_API_BASE_URLpointing at your Modal backend- Durable Object bindings from
edge-control-plane/wrangler.jsonc - optional
RATE_LIMITERbinding if you want rate limiting at the edge
Create the KV namespace if you have not already:
wrangler kv:namespace create SESSION_CACHE
Local Development
Use the checked-in development environment for local Worker work:
cd edge-control-plane
npm run dev
That command runs wrangler dev --env development.
Production Deploy
Deploy the canonical public Worker:
cd edge-control-plane
npm run deploy
Record the Worker URL from the deploy output. You will use it in the smoke test.