Workers

Edge Intelligence

Cloudflare attaches datacenter metadata to every request at the edge. Zero API calls — it's in request.cf. You're being served from the datacenter below.

Loading edge data…
100K req/day free geo.js ↗
Workers KV

Global Counter

Atomic KV increment on every pageview. KV is eventually consistent — reads propagate across 300+ edge locations within ~60 seconds. The KV operation itself at the edge is sub-millisecond.

total visits
KV reads today
100K reads / 1K writes per day counter.js ↗
D1 SQLite

Database at the Edge

Full SQLite at Cloudflare's edge. 5M reads + 100K writes/day free. Relationships, indexes, aggregate queries — all working. 3-table schema with seed data that survives daily wipe.

↑ Cloudflare Turnstile — privacy-preserving proof-of-humanity, free & unlimited. No cookies, no Google.
Loading messages…
5GB storage · 5M reads / 100K writes per day functions/api/d1/ ↗
Workers KV

Edge Cache Demo

Click once → cache miss, queries D1 (slow). Click again within 60s → cache hit, served from KV (fast). The timing delta proves why caching matters at the edge.

100K reads / 1K writes per day kv/cache.js ↗
Workers AI

LLM Inference

Llama 3.1 8B running at the edge via an AI binding. No GPU provisioning, no model deployment — just a binding call.

Free beta · @cf/meta/llama-3.1-8b-instruct ai/generate.js ↗
R2 Storage

Object Storage — Zero Egress

S3-compatible object storage. Upload is Turnstile-gated and capped at 500KB. User uploads are prefixed upload- and wiped regularly. Demo images (prefixed demo-) persist across wipes.

Drop an image or click to browse

JPEG · PNG · GIF · WebP · max 500KB · wiped nightly

10GB storage · 1M Class A ops/month · zero egress functions/api/r2/ ↗

Free Tier Headroom today's usage vs. daily limits

Loading…

Architecture

Browser ──── Cloudflare Edge Network (300+ global PoPs)
  │
  ├── /                    ──→  Pages  (static assets, global CDN, zero config)
  │
  ├── /api/geo             ──→  Workers  →  request.cf  (edge metadata, no DB)
  ├── /api/counter         ──→  Workers  →  KV          (global visit counter)
  ├── /api/guestbook       ──→  Workers  →  D1 + Turnstile
  ├── /api/d1/stats        ──→  Workers  →  D1          (GROUP BY, COUNT, AVG)
  ├── /api/d1/search       ──→  Workers  →  D1          (LIKE full-text search)
  ├── /api/d1/posts        ──→  Workers  →  D1          (JOIN posts ↔ tags)
  ├── /api/kv/cache        ──→  Workers  →  KV  ──(hit)──→  return cached
  │                                             └─(miss)──→  D1  →  KV.put
  ├── /api/ai/generate     ──→  Workers  →  Workers AI  (Llama 3.1 8B Instruct)
  ├── /api/r2/upload       ──→  Workers  →  R2 + Turnstile
  ├── /api/r2/list         ──→  Workers  →  R2          (list + metadata)
  ├── /api/r2/file/:key    ──→  Workers  →  R2          (stream with etag)
  ├── /api/stats           ──→  Workers  →  D1 + KV + R2  (aggregate dashboard)
  └── /api/admin/wipe      ──→  Workers  →  D1 + R2 + KV  (wipe + re-seed)
                                                ↑
                                  Schedule via standalone Worker cron
                                  or external service (e.g. cron-job.org)
                                  Expression:  0 0 * * *  (midnight UTC daily)