Setting the file. One moment.
Chapter 04 · Cloudflare Deploy
Subchapter 4.274
references/workers-for-platforms/README.mdMarkdown4 KBView on GitHub
Multi-tenant platform with isolated customer code execution at scale.
NOT for general Workers - only for Workers for Platforms architecture.
One-click deploy: Platform Starter Kit (opens in a new tab) deploys complete WfP setup with dispatch namespace, dispatch worker, and user worker example.
Manual setup: See configuration.md for namespace creation and dispatch worker configuration.
4 Components:
Request Flow:
Request → Dispatch Worker → Determines user Worker → env.DISPATCHER.get("customer")
→ User Worker executes (Outbound Worker for external fetch) → Response → Dispatch Worker → ClientNeed to run code?
├─ Your code only → Regular Workers
├─ Customer/AI code → Workers for Platforms
└─ Untrusted code in sandbox → Workers for Platforms OR Sandbox APIHostname routing needed?
├─ Subdomains only (*.saas.com) → `*.saas.com/*` route + subdomain extraction
├─ Custom domains → `*/*` wildcard + Cloudflare for SaaS + KV/metadata routing
└─ Path-based (/customer/app) → Any route + path parsingWorker mode?
├─ Running customer code → Untrusted (default)
├─ Need request.cf geolocation → Trusted mode
├─ Internal platform, controlled code → Trusted mode with cache key prefixes
└─ Maximum isolation → Untrusted + unique resources per customer| File | Purpose | When to Read |
|---|---|---|
| configuration.md | Namespace setup, dispatch worker config | First-time setup, changing limits |
| api.md | User worker API, dispatch API, outbound worker | Deploying workers, SDK integration |
| patterns.md | Multi-tenancy, routing, egress control | Planning architecture, scaling |
| gotchas.md | Limits, isolation issues, best practices | Debugging, production prep |