01 / DECISION
When this primitive earns a place
Use Workers for programmable request logic close to users; split long, stateful, or asynchronous work into purpose-built primitives.
02 / ARCHITECTURE
Build the smallest defensible path
Define a narrow route, validate method and payload, bind dependencies through configuration, return typed errors, and emit enough context to reproduce failures.
- 01Name the contract
Use Workers for programmable request logic close to users; split long, stateful, or asynchronous work into purpose-built primitives.
- 02Add one primitive
Define a narrow route, validate method and payload, bind dependencies through configuration, return typed errors, and emit enough context to reproduce failures.
- 03Capture failure evidence
Test allowed and denied methods, malformed bodies, dependency failures, and a deployed health route; compare local and production behavior.
03 / REPRODUCE
Evidence before confidence
Test allowed and denied methods, malformed bodies, dependency failures, and a deployed health route; compare local and production behavior.
npm create cloudflare@latest 04 / BOUNDARY
The production boundary
Do not place secrets in source or turn one Worker into an unbounded orchestrator. Runtime limits and downstream failure remain part of the design.
05 / FIRST-PARTY SOURCES
Keep first-party sources authoritative
Product behavior, limits, pricing, and availability can change. Re-check these sources before acting.