# Edge-First Architecture

 Stu Kennedy  ·  May 2026  ·   Cloudflare  Edge  Workers  SQLite

 Forget regions. Forget availability zones. Run your code, your data, and your state within 50 milliseconds of every human on the planet.

## The Old World

 A user in Edinburgh hits your app. The request travels to London (your AWS region). Your ECS container wakes up. It queries RDS. It caches in ElastiCache. It returns JSON. The browser boots React, parses it, diffs the virtual DOM, patches the real DOM. Total time: 800ms for a "hello world."

  **The fundamental insight:** Cloudflare has ~330 data centres worldwide. Every single one can run your code. Every single one can run SQLite. The "edge" isn't a concept — it's a physically distributed computer the size of the planet.

## The Stack

  ⚡
### Workers

 Your code. V8 isolates, not containers. Cold start <5ms. Runs in every PoP globally.

  🗄️
### D1

 SQLite at the edge. Read-optimized replicas in every PoP. Full SQL, not a NoSQL subset.

  🔒
### Durable Objects

 Stateful singletons with their own SQLite database. WebSocket sessions, agent state, real-time coordination.

  📦
### R2

 S3-compatible storage. Zero egress fees. Store once, serve from the edge.

  🤖
### Workers AI

 Run ML models at the edge. LLMs, embeddings, image classification — same V8 isolate as your app code.

## The Cost Advantage

  Component  AWS  Cloudflare
  Compute  EC2: $15/mo  Workers: $0 (free tier)
  Database  RDS: $15/mo  D1: $0 (free tier)
  CDN  CloudFront: $5–50/mo  Built in
  Storage  S3: $0.23/GB + egress  R2: $0.015/GB, zero egress
  **Total**  **~$50–100/mo**  **~$0–5/mo**

## Further Reading

- [Free The Web](/p/free-the-web) — the hypermedia principles

- [Why HTML Wins](/p/why-html-wins) — HTML vs JSON

- [The Surfable Web](/p/surfable-web) — putting it all together

 Published on [html.surf](/p/index) — surfable knowledge for humans + AI
