You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/reference-architecture/diagrams/serverless/programmable-platforms.mdx
+37-36Lines changed: 37 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,91 +2,93 @@
2
2
title: Programmable Platforms
3
3
pcx_content_type: reference-architecture-diagram
4
4
products:
5
-
- Workers
6
-
- KV
5
+
- Workers
6
+
- KV
7
7
sidebar:
8
-
order: 1
9
-
label: Programmable Platforms
10
-
updated: 2025-03-12
8
+
order: 1
9
+
label: Programmable Platforms
10
+
updated: 2025-03-16
11
11
---
12
12
13
13
14
14
## Introduction
15
15
16
-
A programmable platform is a software ecosystem that enables customers to extend and customize core functionality through code. Unlike traditional SaaS offerings with fixed features, programmable platforms empower customers to build bespoke solutions within the platform's infrastructure, creating unique experiences while leveraging the platform's core capabilities.
16
+
A programmable platform is a software ecosystem that enables customers to extend and customize core functionality through code. Unlike traditional SaaS offerings with fixed features, programmable platforms empower customers to build tailored solutions within the platform’s infrastructure, creating unique experiences while leveraging the platform’s core capabilities. These platforms enable a high degree of customization, allowing users to deploy their own backend logic, host frontend applications, or even run full-stack experiences - all within the provider’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.
17
21
18
-
Cloudflare Workers for Platforms provides the ideal infrastructure for building programmable platforms by offering secure, isolated environments where customers can safely execute custom code without compromising the integrity or performance of the underlying platform.
19
22
20
23
## Core Architecture Components
21
24
22
-
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:
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.
23
26
24
-
1.**Dynamic Dispatch Worker**: The entry point for client requests that routes traffic to the appropriate customer-specific worker based on request parameters.
27
+
1.**Main Request Flow**: An overview over the a request flow in a programmable platform.
25
28
26
-
2.**Dispatch Namespace**: A logical grouping of customer-specific workers that isolates resources and execution environments.
29
+
2.**Invocation & Metadata Flow**: commonly, incoming requests and enriched with metadata to provide the function invocation with relevant context or perform routing logic.
27
30
28
-
3.**User Workers**: Customer-specific workers that process isolated workloads within their own secure execution context.
31
+
3.**Egress Control**: controlling outbound connections to ensure compliant behaviour.
29
32
30
-
4.**Storage & Data Resources**: Various data storage options (D1, KV, R2, Durable Objects) that can be isolated per customer.
33
+
4.**Utilizing Storage & Data Resources**: leveraging databases & storage to build even richer end-user expierences at scale.
31
34
32
35
5.**Observability Tools**: Logging and metrics collection services to monitor platform performance and troubleshoot issues.
33
36
34
37
## Main Request Flow
35
38
36
-

39
+

37
40
38
41
39
-
1.**Client Request**: A request is sent from a client application to the platform's Dynamic Dispatch Worker.
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).
40
43
41
-
2.**Tenant Identification & Routing**: The Dynamic Dispatch Worker identifies the appropriate customer environment using `env.namespace.get(customer-id)`and routes the request to the corresponding User Worker within the Dispatch Namespace.
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.
42
45
43
-
3.**Isolated Execution**: Each customer's workload runs in an isolated User Worker with its own resources and security boundaries.
44
46
45
47
## Invocation & Metadata Flow
46
48
47
49

48
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.
49
52
53
+
1.**Incoming Request**: Send requests to custom hostnames or a Worker using a Workers wildcard route.
50
54
51
-
1.**Request Routing**: Client requests are directed based on hostname or path patterns:
52
-
- Custom hostnames for specific customers
53
-
- Routing within a shared domain (hostname or path-based)
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.
54
56
55
-
2.**Metadata Lookup**: The Dynamic Dispatch Worker may interact with KV storage to retrieve customer-specific configuration data.
56
-
57
-
3.**Worker Invocation**: Based on the retrieved metadata, requests are routed to the appropriate User Worker in the Dispatch Namespace.
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
58
59
59
## Egress Control Pattern
60
60
61
61

62
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.
63
66
64
-
1.**Internal Routing**: The Dynamic Dispatch Worker routes requests to the appropriate User Worker within the Dispatch Namespace.
67
+
2.**External requests**: Send requests via `fetch()` calls to external services through a controlled Outbound Worker.
65
68
66
-
2.**Controlled External Access**: User Workers can make `fetch()` calls to external services through a controlled Outbound Worker.
69
+
3.**Request interception**: Evaluate outgoing requests and perform core functions like centralized policy enforcement and audit logging.
67
70
68
-
3.**External Service Integration**: The Outbound Worker provides a standardized interface for communicating with external services, allowing for centralized policy enforcement, rate limiting, and audit logging.
69
71
70
72
## Metrics & Logging Architecture
71
73
72
74

73
75
74
76
75
-
1.**Comprehensive Logging**: All Workers in the request flow can send logs to Tail Worker and Logpush services.
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](/workers-for-platforms/configuration/observability/#workers-trace-events-logpush) services.
76
78
77
-
2.**Metrics Collection**: Performance and usage metrics are captured through Analytics Engine and exposed via GraphQL.
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.
78
80
79
-
3.**Third-party Integration**: Logs and metrics can be exported to various external monitoring and analytics platforms like Datadog, Splunk, Grafana, and others.
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/).
80
82
81
83
## Resource Isolation Model
82
84
83
85

84
86
85
-
1.**Client Request**: Requests are routed through the Dynamic Dispatch Worker.
87
+
1.**Incoming Request**: Send requests to custom hostnames or a Worker using a Workers wildcard route.
86
88
87
-
2.**Customer Identification**: The Dynamic Dispatch Worker identifies the appropriate customer environment.
89
+
2.**Worker Invocation**: Route requests to the appropriate User Worker in the Dispatch Namespace.
88
90
89
-
3.**Resource Access**: Each User Worker has access only to its customer-specific resources:
91
+
3.**Resource Access**: Interact with per-script-specific resources:
90
92
- D1 for relational database storage
91
93
- Durable Objects for strongly consistent data
92
94
- KV for high-read, eventually consistent key-value storage
@@ -97,16 +99,14 @@ The Workers for Platforms architecture consists of several key components that w
97
99

98
100
99
101
100
-
1.**Management Interface**: End users interact with the platform through GUI, API, or CLI interfaces.
102
+
1.**Management Interface**: Interact with the platform through GUI, API, or CLI interfaces.
101
103
102
-
2.**Platform Processing**: The SaaS provider processes these interactions to:
104
+
2.**Platform Processing**: Process these interactions to:
103
105
- Transform and bundle code
104
106
- Perform security checks
105
107
- Apply configuration
106
108
107
-
3.**API Deployment**: The processed workloads are deployed to the Dispatch Namespace via the Cloudflare REST API.
108
-
109
-
109
+
3.**Change Management**: Deploy changes to Cloudflare using the Cloudflare REST API.
110
110
111
111
112
112
## Conclusion
@@ -118,3 +118,4 @@ Cloudflare Workers for Platforms provides a robust foundation for building multi
118
118
-[Workers for Platforms: Get started](cloudflare-for-platforms/workers-for-platforms/get-started/)
119
119
-[Workers for Platforms: Outbound Workers](/cloudflare-for-platforms/workers-for-platforms/configuration/outbound-workers/)
120
120
-[Workers for Platforms: Observability](/cloudflare-for-platforms/workers-for-platforms/configuration/observability/)
0 commit comments