All skills
Skillintermediate

Cloudflare Bindings Skill Reference

Expert guidance on Cloudflare Workers Bindings - the runtime APIs that connect Workers to Cloudflare platform resources.

Claude Code Knowledge Pack7/10/2026

Overview

Cloudflare Bindings Skill Reference

Expert guidance on Cloudflare Workers Bindings - the runtime APIs that connect Workers to Cloudflare platform resources.

What Are Bindings?

Bindings are how Workers access Cloudflare resources (storage, compute, services) via the env object. They're configured in wrangler.jsonc, type-safe via TypeScript, and zero-overhead at runtime.

Reading Order

  1. This file - Binding catalog and selection guide
  2. api.md - TypeScript types and env access patterns
  3. configuration.md - Complete wrangler.jsonc examples
  4. patterns.md - Best practices and common patterns
  5. gotchas.md - Critical pitfalls and troubleshooting

Binding Catalog

Storage Bindings

BindingUse CaseAccess Pattern
KVKey-value cache, CDN-backed readsenv.MY_KV.get(key)
R2Object storage (S3-compatible)env.MY_BUCKET.get(key)
D1SQL database (SQLite)env.DB.prepare(sql).all()
Durable ObjectsCoordination, real-time stateenv.MY_DO.get(id)
VectorizeVector embeddings searchenv.VECTORIZE.query(vector)
QueuesAsync message processingenv.MY_QUEUE.send(msg)

Compute Bindings

BindingUse CaseAccess Pattern
ServiceWorker-to-Worker RPCenv.MY_SERVICE.fetch(req)
Workers AILLM inferenceenv.AI.run(model, input)
Browser RenderingHeadless Chromeenv.BROWSER.fetch(url)

Platform Bindings

BindingUse CaseAccess Pattern
Analytics EngineCustom metricsenv.ANALYTICS.writeDataPoint(data)
mTLSClient certificatesenv.MY_CERT (string)
HyperdriveDatabase poolingenv.HYPERDRIVE.connectionString
Rate LimitingRequest throttlingenv.RATE_LIMITER.limit(id)
WorkflowsLong-running workflowsenv.MY_WORKFLOW.create()

Configuration Bindings

BindingUse CaseAccess Pattern
Environment VariablesNon-sensitive configenv.API_URL (string)
SecretsSensitive valuesenv.API_KEY (string)
Text/Data BlobsStatic filesenv.MY_BLOB (string)
WASMWebAssembly modulesenv.MY_WASM (WebAssembly.Module)

Quick Selection Guide

Need persistent storage?

  • Key-value < 25MB → KV
  • Files/objects → R2
  • Relational data → D1
  • Real-time coordination → Durable Objects

Need AI/compute?

  • LLM inference → Workers AI
  • Scraping/PDFs → Browser Rendering
  • Call another Worker → Service binding

Need async processing?

  • Background jobs → Queues

Need config?

  • Public values → Environment Variables
  • Secrets → Secrets (never commit)

Quick Start

  1. Add binding to wrangler.jsonc:
{
  "kv_namespaces": [
    { "binding": "MY_KV", "id": "your-kv-id" }
  ]
}
  1. Generate types:
npx wrangler types
  1. Access in Worker:

  async fetch(request, env, ctx) {
    await env.MY_KV.put('key', 'value');
    return new Response('OK');
  }
}

Type Safety

Bindings are fully typed via wrangler types. See api.md for details.

Limits

  • 64 bindings max per Worker (all types combined)
  • See gotchas.md for per-binding limits

Key Concepts

Zero-overhead access: Bindings compiled into Worker, no network calls to access Type-safe: Full TypeScript support via wrangler types Per-environment: Different IDs for dev/staging/production Secrets vs Vars: Secrets encrypted at rest, never in config files

See Also