Serverless Edge Compute, API Handlers, Storage Bindings, and Full-Stack Deployment
How edge Workers run serverless code globally, pair with storage and security products, and when to use them for APIs and full-stack apps.
This page summarises Cloudflare Workers and related Cloudflare Developer Platform documentation for people who want serverless backends or APIs without managing regions, servers, or capacity planning. Workers is Cloudflare’s primary serverless execution environment: request handlers run close to users on a globally distributed network, with optional bindings to storage, queues, AI, and security products.
What Cloudflare Workers is and how execution works
Section titled “What Cloudflare Workers is and how execution works”Cloudflare Workers gives developers the power to deploy serverless code instantly to Cloudflare’s global network.
Cloudflare Workers gives developers the power to deploy serverless code instantly to Cloudflare’s global network.
— Cloudflare, Cloudflare Workers (concepts)
Workers is described as a serverless computing provider where Cloudflare manages servers so you focus on application logic. Compared with renting fixed server capacity, serverless providers scale automatically to match request volume.
The runtime runs in every data center of Cloudflare’s global network. Every Worker runs within its own isolate. Isolate architecture is what makes Workers efficient.
The Cloudflare Workers runtime runs in every data center of Cloudflare’s global network ↗︎. Every Worker run within its own isolate. Isolate architecture is what makes Workers efficient.
— Cloudflare, Cloudflare Workers (concepts)
For backends specifically, Cloudflare Workers positions Workers to build APIs and connect to data stores, with Smart Placement to optimise latency. Build serverless backends adds that V8 isolates start in milliseconds with no warm-up period, avoiding cold-start delays common on container-based platforms, and that code runs at the nearest Cloudflare location with auto-scaling across 300+ locations.
A single project can be a one-route HTML response or span multiple domains and routes; multiple Workers can compose one product experience and use Developer Platform storage, media, and AI services.
Cloudflare Developer Platform: compute, storage, and full-stack pieces
Section titled “Cloudflare Developer Platform: compute, storage, and full-stack pieces”The Cloudflare Developer Platform bundles compute, storage, web development, image optimisation, video, and AI. Get started describes the Build area as where you create and deploy sites and full-stack apps on Workers and connect primitives such as KV, D1, R2, Queues, and Durable Objects.
Fullstack applications frames the platform as a composable ecosystem: Workers handle dynamic requests (auth, routing, APIs), Workers Assets can serve framework front ends, Workers for Platforms supports user-deployed code, Durable Objects add low-latency stateful compute, and Containers cover Docker-compatible workloads that need more resources than a standard Worker.
Web sites and web apps lists a typical stack: Workers for front-end assets and API routes, D1 for relational data, R2 for uploads. Deploy frontend applications notes Git-driven deploys, preview URLs per pull request, and serving static assets plus API routes from one deployment.
Storage bindings: which product fits which workload
Section titled “Storage bindings: which product fits which workload”Choosing storage is a common reason people read Workers docs. Choose a data or storage product maps industry terms to Cloudflare products:
| Use case | Product | Ideal for |
|---|---|---|
| Key-value storage | Workers KV | Configuration data, service routing metadata, personalization (A/B testing) |
| Object / blob storage | R2 | Web assets, images, ML datasets, analytics and log data |
| Accelerate Postgres or MySQL | Hyperdrive | Existing databases with familiar drivers and ORMs |
| Global coordination & stateful serverless | Durable Objects | Collaborative apps, WebSockets, strongly consistent transactional storage |
| Lightweight SQL | D1 | User profiles, listings, orders, relational customer data |
| Task processing & messaging | Queues | Background jobs, notifications, deferred tasks |
| Event streaming | K2 | High-volume events, multiple consumers, replay |
| Vector search | Vectorize | Embeddings, semantic search, classification |
| Streaming ingestion | Basin Pipelines | Clickstream, telemetry, structured ingest |
| Time-series metrics | Analytics Engine | High-cardinality usage and service telemetry |
Applications often combine products—for example KV for session or config data, R2 for large files, and Hyperdrive for a hosted Postgres. Store application data states the same pattern in plain terms for web apps.
Workers KV is explicitly tied to routing metadata and A/B testing using Workers. Static assets on Workers describes a unified deployment: front-end assets and backend logic in one Worker with KV, D1, and R2.
Deploy and protect APIs at the edge
Section titled “Deploy and protect APIs at the edge”Why global serverless APIs differ from single-region functions
Section titled “Why global serverless APIs differ from single-region functions”Serverless global APIs explains that many serverless platforms run code in one region, so every request crosses the Internet twice. Cloudflare’s model distributes compute (and ideally data via cache or replication) for lower latency and availability.
Deploy APIs at the edge states that Workers runs API handlers in 300+ locations with automatic scaling and fast startup, without regional configuration or capacity limits.
Edge-native API building blocks
Section titled “Edge-native API building blocks”APIs and microservices lists the usual control plane: Workers for handlers, API Shield for OpenAPI validation, Rate Limiting, mTLS, Tunnel and Access for internal services, and Logpush plus Workers Analytics Engine for monitoring. Edge-native APIs on the same page summarise routing and logic on Workers, D1 or KV for data, and Queues for async work and webhooks.
Reference flow from Serverless global APIs:
- Client hits the API endpoint.
- Workers (and optionally API Shield) validate and authenticate; Service bindings can forward to other Workers without public URLs.
- Read-heavy config may come from KV; relational paths use D1; legacy databases use Hyperdrive with caching where migration is out of scope.
API Gateway describes the broader developer platform: serverless APIs on the global network, integrated storage, databases, and AI, with framework support for API workflows.
Protect your APIs highlights edge JWT validation and custom auth (API keys, HMAC, custom headers) before traffic reaches origin.
Framework guides — APIs lists FastAPI, Flask, and Hono for full-stack API apps on Workers.
Integrating external APIs from a Worker
Section titled “Integrating external APIs from a Worker”APIs (Workers configuration) recommends the Cache API for cacheable third-party API responses and Custom Domains so the Worker is treated as the core application when calling external APIs.
Common patterns: performance, private access, platforms, and cron jobs
Section titled “Common patterns: performance, private access, platforms, and cron jobs”Performance at the edge — Accelerate your store’s performance and Optimize performance describe edge logic: HTML rewriting and dynamic assembly without round-trips to origin.
Private APIs and buckets — Workers VPC examples and private S3 bucket point to follow-on hardening: authentication, rate limiting, monitoring (details live in those guides’ next-step lists).
Programmable / SaaS platforms — Advanced Settings (Cloudflare for SaaS) includes Workers as your fallback origin alongside apex proxying and custom origins. Store and isolate customer data points to D1, R2, and Durable Objects get-started flows.
Operational automation — BGP anomalies is an example pattern: Cron Triggers, Cloudflare API + API token, KV for deduplication, webhooks for alerts.
AI and agents — Build and run AI applications mentions streaming token responses and full-stack deployment from one Workers deployment; Workers AI links Vectorize, AI Gateway, and related products.
Workers vs Snippets: when full Workers are required
Section titled “Workers vs Snippets: when full Workers are required”When to use Snippets vs Workers contrasts Snippets with Workers as a full-stack compute platform with state, Developer Platform integrations, usage-based pricing, and a free tier.
Snippets are not designed for persistent state, heavy compute (e.g. image transform or AI inference), deep Durable Objects or D1 integrations, or advanced runtime features: environment variables, observability, bindings, cron triggers, and higher compute limits. If your design needs those, Workers (not Snippets) is the documented fit.
Common mistakes
Section titled “Common mistakes”- Wrong storage for consistency — Using KV for data that needs strong consistency or frequent writes; the storage guide positions Durable Objects or D1 for transactional or relational needs.
- Single-region assumptions — Calling a central database on every edge request without Hyperdrive, caching (APIs integration tips), or edge-local data.
- Split hosting — Serving static assets from a separate host when static assets on Workers documents a single Worker for assets and logic.
- Security only at origin — Skipping edge JWT or rate limits described in Protect your APIs and APIs and microservices.
- Snippets for app logic — Using Snippets where bindings, cron, or D1/Durable Objects are required (When to use Snippets vs Workers).
How to check this on your site
Section titled “How to check this on your site”-
Confirm your project type matches the docs: read When to use Snippets vs Workers if you only need light request rewriting; otherwise follow Cloudflare Workers and Get started for full compute and bindings.
-
Map each data need to a product using Choose a data or storage product and ensure bindings in your Worker match that table (KV vs D1 vs R2 vs Durable Objects vs Hyperdrive).
-
For public APIs, align your design with Deploy APIs at the edge and Protect your APIs; for OpenAPI validation and gateway features, review API Gateway.
-
After deployment, use Workers observability and analytics options described in APIs and microservices (Logpush, Workers Analytics Engine) and check deployment behaviour against the patterns in Serverless global APIs.
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.