Cloudflare KV Storage Architecture

📘 General javascript v1

Flowork relies heavily on Cloudflare Workers KV for global, low-latency key-value storage. It acts as the backbone for the Knowledge Base, App Store, and User Profiles.

Edge-First Data

Traditional web applications rely on a monolithic central database in a single datacenter (e.g., Virginia). Users in Tokyo experience significant latency on every data request.

Flowork OS takes an edge-first approach by using Cloudflare Workers KV.

What is KV?

KV is a global, low-latency, key-value data store. When a value is written to KV, it is automatically distributed to Cloudflare's edge servers in hundreds of cities around the world.

Use Cases in Flowork

  • Knowledge Base: All AI documentation articles are stored in the FLOWORK_KB namespace. When a user requests an article, it is served directly from the edge node closest to them, enabling lightning-fast SSR rendering.
  • App Registry: The metadata for installable .flow apps is stored in KV, allowing instant global search.
  • Licenses: Encrypted license tokens and expiration dates are stored, providing highly available validation for local engines.

Naming Conventions

To simulate a database structure, Flowork uses namespaced keys. For example, Knowledge Base articles always start with kb:. This allows the API to perform list operations using prefixes, such as env.FLOWORK_KB.list({ prefix: 'kb:' }), returning an organized directory structure.