Cloudflare · Cloudflare Workers · Diagram as code

Cloudflare Workers architecture diagram

Describe a Worker and the D1, R2 or KV data it touches. ArchLex keeps Cloudflare resources at the edge (not inside a VPC) and validates the connections you declare.

Worker with D1 and R2.

API Worker writing relational state to D1 and objects to R2.

Cloudflare Workers architecture diagram: Worker writes to D1 and R2Cloudflare Workers architecture diagram: Worker writes to D1 and R2
provider cloudflare
direction LR

edge: workers["API Worker"]
db: d1["App DB"]
blob: r2["Uploads"]

edge -[writes]-> db
edge -[writes]-> blob

Open this diagram in the playground

Worker with D1, R2 and KV inside an account.

Group edge resources under a Cloudflare account scope and add KV for session cache.

Cloudflare Workers architecture diagram: account with Worker, D1, R2 and KVCloudflare Workers architecture diagram: account with Worker, D1, R2 and KV
provider cloudflare
direction LR
account production {
  edge: workers["API Worker"]
  db: d1["App database"]
  files: r2["Uploads"]
  cache: kv["Session cache"]

  edge -[writes]-> db
  edge -[writes]-> files
  edge -[reads]-> cache
}

Open this diagram in the playground

Pattern notes for Cloudflare Workers.

Placement and relationship rules ArchLex enforces for this service.

Ask an agent to draw it.

Install the ArchLex skill or connect the free MCP server, then paste this prompt.

Agent skill install
npx skills add baires/archlex
Draw a Cloudflare Workers architecture diagram with a Worker writing to D1 and R2 and reading KV for sessions. Validate placement and give me a playground link.

Prefer MCP? Follow the MCP server guide.

Related Cloudflare examples.

Browse all examples

Cloudflare Workers diagram questions.

How do I diagram Cloudflare Workers with D1 and R2?

Declare workers, d1 and r2 (optionally under an account scope). Connect with -[writes]-> and -[reads]->. Keep everything out of VPC or Kubernetes scopes.

Why did I get CLOUDFLARE-CONTAINMENT-001?

A Cloudflare resource was placed inside a region, VPC, subnet, cluster or namespace. Move it to the document root or a logical account.

Can Workers talk to AWS or GCP origins in one diagram?

Yes. Use qualified kinds and multiple providers. The Cloudflare public-edge-to-AWS gallery example shows the pattern.

Is ArchLex affiliated with Cloudflare?

No. ArchLex is a community project. Cloudflare names and trademarks remain with their owners. Icons are bundled under CC BY 4.0 attribution.

More Cloudflare service diagrams.

Open source · MIT licensed

Diagram Cloudflare Workers as code.