Workers KV
What it is
Workers KV is a global key-value store designed for reads. You write a value once, and Cloudflare replicates it across its network so that any Worker, anywhere, can read it with very low latency. It's eventually consistent: a write becomes visible everywhere within a short window, which is the trade-off for being fast and global.
Strengths
- Extremely fast, low-latency reads from anywhere on the edge.
- Globally replicated automatically — no regions to manage.
- Simple API:
get,put,delete,list, with optional TTLs. - Cheap at scale for read-heavy workloads; usable free tier.
- Binds straight into Workers and Pages Functions.
Trade-offs
- Eventually consistent — not for data that must be correct the instant after a write.
- Writes are slower and rate-limited compared to reads.
- Value size is capped (around 25 MB); it's not bulk storage like R2.
- No queries or relations — it's strictly key to value.
When to use it
Use KV for configuration, feature flags, cached API responses, routing tables, session lookups, and any read-mostly data that you can tolerate being a few seconds stale.
Vibe coding fit
KV is an easy win for an agent adding caching or config to a Worker: one binding, then get/put. Be explicit that it's eventually consistent, so the agent doesn't reach for KV where it needs read-after-write guarantees — point it at D1 or a Durable Object for that. The snippet binds a namespace and seeds a value.
# wrangler.toml
[[kv_namespaces]]
binding = "CONFIG"
id = "your-kv-namespace-id"
npx wrangler kv namespace create CONFIG
npx wrangler kv key put --binding=CONFIG "theme" "dark"