patterns.md

Created about 12 hours ago

attributes
source_pathreferences/bindings/patterns.md
source_sha2563febffffb2480603368f23923867b7e9c7af110689d661decf1a4ba8194b762f
source_urlhttps://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/cloudflare/references/bindings/patterns.md
supporting_skill_id40184
upstream_revision47dfc2ce969bf62acf8bc231198ade4bb02712e0

Binding Patterns

Choose the interaction and lifecycle first, then retrieve the implementation guide.

Task Current documentation
Choose HTTP forwarding or RPC between Workers Service bindings
Forward Requests and Responses through a service binding Service bindings over HTTP
Expose callable methods with WorkerEntrypoint Service bindings over RPC and RPC TypeScript
Run connected Workers during development Developing with multiple Workers
Test handlers against configured bindings and mock dependencies Workers Vitest configuration and test APIs
Select KV, D1, R2, or Durable Objects Storage options
Keep clients current when bindings change Binding lifecycle
Manage credentials used by external API clients Secrets

Use service bindings for internal Worker calls when appropriate, and choose HTTP or RPC based on the interface being exposed. A service binding does not replace application-level authorization for the caller's requested operation.

Choose storage based on access patterns and consistency requirements, not copied size or latency thresholds. Parallelize independent binding operations when useful; preserve ordering where one operation depends on another's result.

Avoid retaining clients derived from mutable bindings across requests without accounting for binding updates. Importing env is supported, but binding I/O still requires an appropriate execution context; follow the lifecycle guide rather than assuming all global access is forbidden.

Children

No children yet.

Like how this is organised?

Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.