Appearance

Visual style

Mode
Theme
Accent
Advanced
Text sizeScales the whole site
16 px
Reduce motionReduce animations or match your system
Separate light and darkChoose a theme, accent and font for each
50

Technology · Cloud & DevOps

Cloudflare Workers development

Cloudflare Workers is a serverless platform that runs JavaScript, TypeScript and WebAssembly on Cloudflare's global network. Its documentation describes a V8-isolate runtime based on web-standard APIs, with bindings to storage and messaging products such as KV, R2, D1, Queues and Durable Objects.

In practice

How I use Cloudflare Workers

Workers is my default deployment target. Ekonavi's platform runs as multiple Workers: Next.js frontends via OpenNext, Hono API services and the marketplace commerce API. A creator commerce platform I built uses Workers with R2 for digital files, Queues for payment events and a cron trigger for a safety sweep. Most of my static sites are also served from Workers.

A typical Workers architecture

            ┌──────────────┐   HTTP   ┌──────────────────────┐
 Browser ──▶│ Next.js app  │────────▶│ Hono API Worker       │──▶ Postgres (Neon) via Drizzle
            │ (OpenNext)   │         │  /v1/products, orders │──▶ R2 (private files)
            └──────────────┘         │  /v1/webhooks/*       │──▶ Queue producer
                                     └──────────┬───────────┘
                                                │ Queue (payment events, retries, DLQ)
                                     ┌──────────▼───────────┐
                                     │ Queue consumer       │──▶ Email (Resend)
                                     │ + cron sweep (6h)    │
                                     └──────────────────────┘

This is the shape of the creator commerce platform. The frontend and API are separate Workers coupled only over HTTP: no shared build dependency, so each can be deployed independently.

Environments in Wrangler config

Bindings are declared per environment in wrangler.toml. Development and production each get their own R2 bucket and payment queue, and production adds a dead-letter queue. Code reads env.ASSETS_BUCKET or env.PAYMENT_QUEUE and never knows which environment it’s in.

Queues and cron triggers

  • Queues decouple webhook receipt from processing: the webhook handler verifies and enqueues, then returns immediately.
  • Cron Triggers run a scheduled job (every six hours on that platform) that finds paid-but-unfulfilled orders and completes them, a safety net for anything the queue path missed.

Multi-app deployments

On Ekonavi, multiple apps deploy to Workers from one monorepo. GitHub Actions builds affected apps, deploys to staging, and promotes to production through a matrix job, so every app follows the same release path.

Trade-offs

Where Cloudflare Workers shines, and where it doesn't

Strengths

  • No servers or regions to manage; requests run close to users worldwide.
  • Bindings (R2, Queues, KV, cron) are declared per environment in config, which makes staging and production reproducible.
  • Fast cold starts thanks to V8 isolates.
  • Static assets, APIs and background jobs can live on one platform.

Limitations

  • Not full Node.js. Libraries that depend on Node built-ins need the nodejs_compat flag or replacements.
  • CPU-time and memory limits make it the wrong place for heavy compute such as video processing.
  • Connecting to a traditional database needs a serverless driver or connection pooling (for example Neon's serverless driver or Hyperdrive).

Evidence

Projects using Cloudflare Workers

All work →

Sources

Official documentation

General descriptions on this page are based on the official documentation linked below. Experience notes are my own.

FAQ

Cloudflare Workers questions

Is Cloudflare Workers suitable for a full web application?

Yes, for most business applications. I run Next.js frontends, REST APIs, webhook handlers and background queues on Workers. The exceptions are long-running or CPU-heavy jobs, which belong on a container or a dedicated service.

How do you handle staging and production on Workers?

Each Worker has named environments in its Wrangler config, with separate bindings for storage buckets, queues and secrets. CI deploys to staging first and promotes to production once checks pass, so production never runs an untested configuration.

Can Workers connect to PostgreSQL?

Yes, through a serverless-friendly path. I've used Neon's serverless driver with Drizzle ORM from a Worker; Cloudflare's Hyperdrive is another option that pools connections to an existing Postgres database.

What are Cloudflare Queues used for?

Cloudflare Queues pass messages between Workers so slow or unreliable work happens outside the request. A webhook handler enqueues an event and responds immediately; a consumer processes it with batching, retries and an optional dead-letter queue for messages that keep failing.

What is Cloudflare R2?

R2 is Cloudflare's S3-compatible object storage, with no egress fees for data served out of it. I use it for private files such as purchased digital products, served through short-lived signed URLs rather than public links.

Need a Cloudflare Workers developer?

If your project needs Cloudflare Workers, send a short description of what you're building and where it's stuck. I'll reply with how I'd approach it.