Skip to content

Commit 320a461

Browse files
markdemboRebeccaTamachiro
authored andcommitted
[RAD] Programmable Plaforms (#20856)
* [RAD] Programmable Plaforms MVP * Update content * Add cross-reference to WFP section * Fix links * Simplify intro
1 parent fa6639b commit 320a461

File tree

8 files changed

+44705
-2
lines changed

8 files changed

+44705
-2
lines changed

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-1.svg

Lines changed: 7393 additions & 0 deletions
Loading

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-2.svg

Lines changed: 7421 additions & 0 deletions
Loading

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-3.svg

Lines changed: 7419 additions & 0 deletions
Loading

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-4.svg

Lines changed: 7485 additions & 0 deletions
Loading

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-5.svg

Lines changed: 7449 additions & 0 deletions
Loading

src/assets/images/reference-architecture/programmable-platforms/programmable-platforms-6.svg

Lines changed: 7409 additions & 0 deletions
Loading
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
pcx_content_type: navigation
3-
title: Demos
3+
title: Demos and architectures
44
sidebar:
55
order: 8
66

77
---
88

9-
import { ExternalResources, GlossaryTooltip } from "~/components"
9+
import { ExternalResources, GlossaryTooltip, ResourcesBySelector } from "~/components"
1010

1111
Learn how you can use Workers for Platforms within your existing architecture.
1212

@@ -15,3 +15,9 @@ Learn how you can use Workers for Platforms within your existing architecture.
1515
Explore the following <GlossaryTooltip term="demo application">demo applications</GlossaryTooltip> for Workers for Platforms.
1616

1717
<ExternalResources type="apps" products={["Workers for Platforms"]} />
18+
19+
## Reference architectures
20+
21+
Explore the following <GlossaryTooltip term="reference architecture">reference architectures</GlossaryTooltip> that use Workers:
22+
23+
<ResourcesBySelector types={["reference-architecture","design-guide","reference-architecture-diagram"]} products={["WorkersForPlatforms"]} />
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Programmable Platforms
3+
pcx_content_type: reference-architecture-diagram
4+
products:
5+
- WorkersForPlatforms
6+
- KV
7+
sidebar:
8+
order: 1
9+
label: Programmable Platforms
10+
updated: 2025-03-16
11+
---
12+
13+
14+
## Introduction
15+
16+
A programmable platform allows customers to customize a product by writing code. Unlike traditional SaaS with fixed features, it enables users to extend functionality, deploy backend logic, and build full-stack experiences—all within the platform’s infrastructure.
17+
18+
Hosting the infrastructure for these platforms presents several challenges, including security, scalability, cost efficiency, and performance isolation. Allowing customers to run custom code introduces risks such as untrusted execution, potential abuse, and resource contention, all of which must be managed without compromising platform reliability. Running millions of single-tenant applications is inherently costly, making efficient resource utilization critical. The ability to scale workloads to zero when idle is key to ensuring economic viability while maintaining rapid startup times when demand spikes. Additionally, ensuring seamless global execution with low-latency performance requires a resilient, distributed architecture. Robust monitoring, debugging, and governance capabilities are also essential to provide visibility and control over customer-deployed code without restricting innovation.
19+
20+
[Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/) provides the ideal infrastructure for building programmable platforms by offering secure, isolated environments where customers can safely execute custom code at scale, with automatic scaling to zero and a globally distributed runtime that optimizes performance and cost.
21+
22+
23+
## Core Architecture Components
24+
25+
The Workers for Platforms architecture consists of several key components that work together to provide a secure, scalable, and efficient solution for multi-tenant applications. In the following core concepts are outlined.
26+
27+
1. **Main Request Flow**: An overview over the a request flow in a programmable platform.
28+
29+
2. **Invocation & Metadata Flow**: commonly, incoming requests and enriched with metadata to provide the function invocation with relevant context or perform routing logic.
30+
31+
3. **Egress Control**: controlling outbound connections to ensure compliant behaviour.
32+
33+
4. **Utilizing Storage & Data Resources**: leveraging databases & storage to build even richer end-user expierences at scale.
34+
35+
5. **Observability Tools**: Logging and metrics collection services to monitor platform performance and troubleshoot issues.
36+
37+
## Main Request Flow
38+
39+
![Figure 1: Workers for Platforms: Main Flow](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-1.svg "Figure 1: Workers for Platforms: Main Flow")
40+
41+
42+
1. **Client Request**: Send request from a client application to the platform's [Dynamic Dispatch Worker](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#dynamic-dispatch-worker).
43+
44+
2. **Routing**: Identify the correct workload to execute and route the request to the respective [User Worker](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#user-workers) in the [Dispatch Namespace](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#dispatch-namespace). Each customer's workload runs in an isolated User Worker with its own resources and security boundaries.
45+
46+
47+
## Invocation & Metadata Flow
48+
49+
![Figure 2: Workers for Platforms: Main Flow](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-2.svg "Figure 2: Workers for Platforms: Main Flow")
50+
51+
For many use cases, it makes sense to retrieve additional metadata, user data, or configuration to process incoming requests and provide the User Worker invocation with additional context.
52+
53+
1. **Incoming Request**: Send requests to custom hostnames or a Worker using a Workers wildcard route.
54+
55+
2. **Metadata Lookup**: Retrieve customer-specific configuration data from [KV](/kv/) storage. These lookups are typically based on the hostname of the incoming request or custom metadata in the case of custom hostnames.
56+
57+
3. **Worker Invocation**: Route requests to the appropriate User Worker in the Dispatch Namespace based on metadata. Optionally, provide additional context during function invocation.
58+
59+
## Egress Control Pattern
60+
61+
![Figure 3: Workers for Platforms: Egress Control](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-3.svg "Figure 3: Workers for Platforms: Egress Control")
62+
63+
Data observability and control is crucial for security. [Outbound Workers](/cloudflare-for-platforms/workers-for-platforms/configuration/outbound-workers/) allow for interception of all outgoing requests in User Worker scripts.
64+
65+
1. **Worker Invocation**: Route requests to the appropriate User Worker in the Dispatch Namespace. Optionally pass additional parameters to the Outbound Worker during User Worker invocation.
66+
67+
2. **External requests**: Send requests via `fetch()` calls to external services through a controlled Outbound Worker.
68+
69+
3. **Request interception**: Evaluate outgoing requests and perform core functions like centralized policy enforcement and audit logging.
70+
71+
72+
## Metrics & Logging Architecture
73+
74+
![Figure 4: Workers for Platforms: Metrics & Logging](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-4.svg "Figure 4: Workers for Platforms: Metrics & Logging")
75+
76+
77+
1. **Logging**: Collect logs throughout all Workers in the request flow via [Tail Worker](/cloudflare-for-platforms/workers-for-platforms/configuration/observability/#tail-workers) and [Workers Trace Events Logpush](/cloudflare-for-platforms/workers-for-platforms/configuration/observability/#workers-trace-events-logpush) services.
78+
79+
2. **Metrics**: Collect custom metrics via [Workers Analytics Engine](/analytics/analytics-engine/) and out-of-the-box [Analytics](/analytics/graphql-api/) that can readily be queried via GraphQL API.
80+
81+
3. **Third-party Integration**: Export logs and metrics to various external monitoring and analytics platforms like Datadog, Splunk, Grafana, and others via [Analytics integrations](/analytics/analytics-integrations/).
82+
83+
## Resource Isolation Model
84+
85+
![Figure 5: Workers for Platforms: Resources](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-5.svg "Figure 5: Workers for Platforms: Resources")
86+
87+
1. **Incoming Request**: Send requests to custom hostnames or a Worker using a Workers wildcard route.
88+
89+
2. **Worker Invocation**: Route requests to the appropriate User Worker in the Dispatch Namespace.
90+
91+
3. **Resource Access**: Interact with per-script-specific resources:
92+
- D1 for relational database storage
93+
- Durable Objects for strongly consistent data
94+
- KV for high-read, eventually consistent key-value storage
95+
- R2 for object storage
96+
97+
## Deployment & Management Flow
98+
99+
![Figure 6: Workers for Platforms: Deployment & Management Flow](~/assets/images/reference-architecture/programmable-platforms/programmable-platforms-6.svg "Figure 6: Workers for Platforms: Deployment & Management Flow")
100+
101+
102+
1. **Management Interface**: Interact with the platform through GUI, API, or CLI interfaces.
103+
104+
2. **Platform Processing**: Process these interactions to:
105+
- Transform and bundle code
106+
- Perform security checks
107+
- Apply configuration
108+
109+
3. **Change Management**: Deploy changes to Cloudflare using the Cloudflare REST API.
110+
111+
112+
## Conclusion
113+
114+
Cloudflare Workers for Platforms provides a robust foundation for building multi-tenant SaaS applications with strong isolation, global distribution, and scalable performance. By leveraging this architecture, platform providers can focus on delivering value to their customers while Cloudflare handles the underlying infrastructure complexity.
115+
116+
## Related resources
117+
118+
- [Workers for Platforms: Get started](/cloudflare-for-platforms/workers-for-platforms/get-started/)
119+
- [Workers for Platforms: Outbound Workers](/cloudflare-for-platforms/workers-for-platforms/configuration/outbound-workers/)
120+
- [Workers for Platforms: Observability](/cloudflare-for-platforms/workers-for-platforms/configuration/observability/)
121+

0 commit comments

Comments
 (0)