Back to Blog
Engineering August 25, 2025 · 11 min read

Edge Computing: Why We Bet Everything on Cloudflare (And What $65/Month Gets You)

GM

Gonzalo Monzón

Founder & Lead Architect

When we started Cadences, the conventional choice was AWS or GCP. Containers, Kubernetes, managed databases, load balancers — the standard cloud stack that costs thousands per month and requires a DevOps engineer just to keep the lights on. Instead, we went all-in on Cloudflare. Two years and 14+ interconnected products later, our entire infrastructure bill is $65/month. Zero Docker containers. Zero servers. Zero 3 AM pager alerts.

Why Not AWS? (The Honest Answer)

We're a 3-person team. AWS is designed for organizations with dedicated infrastructure engineers. The mental overhead of EC2 instance sizing, RDS connection pooling, S3 egress costs, CloudFront invalidation, ECS task definitions, and VPC configuration — all of that is time we're not spending building product.

Cloudflare's pitch is radically simple: write a JavaScript function, deploy it in 5 seconds, it runs in 300+ data centers worldwide. No provisioning. No scaling decisions. No cold starts. Your function is just… there, everywhere, instantly.

For a small team shipping fast, that simplicity is worth more than any feature AWS offers.

9 Cloudflare Products We Actually Use

This isn't one Worker handling a webhook. We use 9 distinct Cloudflare products, each solving a specific infrastructure need:

1. Workers — All API Logic

Every API endpoint across all 14+ products runs on Workers. 60+ endpoints total. V8 isolates mean zero cold starts — unlike Lambda's container-based model where the first request after idle can take 500ms-2s, Workers respond in single-digit milliseconds from the first request. Deploy with wrangler deploy in under 5 seconds.

2. D1 — SQLite on the Edge

Our primary database. SQLite might sound like a toy, but D1's implementation is production-grade: we have 107+ migrations across all products. Patient records, appointment schedules, AI call logs, workflow state, game data, billing records — all in D1. Window functions, recursive CTEs, JSON functions — they all work. The only real limitation is full-text search (basic), which we supplement with Vectorize for semantic search.

3. R2 — Zero-Egress Object Storage

S3-compatible API, but with zero egress fees. This is critical for us — we serve DICOM medical images (large files, frequent access), generated PDFs, consent forms, audio files, and user uploads. On S3, the egress costs for our DICOM viewer alone would exceed our entire Cloudflare bill.

4. Durable Objects — Stateful Edge Computing

The most underrated Cloudflare product. Durable Objects give us stateful, long-running computation on the edge. We use them for:

  • Workflow execution: Our visual workflow engine runs multi-step automations that can take hours or days. Durable Objects persist state across Worker restarts — if a workflow is waiting for an external webhook, the DO holds state until it arrives
  • WebSocket management: Real-time updates for the workflow editor, live call monitoring (God Mode), and collaborative features
  • Session state: Long-lived user sessions without external Redis

5. Pages — Static Hosting ($0/Site)

All our storefronts and public portals deploy on Cloudflare Pages: GoViajes, Restaurant23, Codex, GoStorm, Clinica23, CIMAD portal — 6 sites on the free tier. Each gets global CDN, automatic HTTPS, preview deployments, and GitHub integration. Cost per storefront: $0.

6. KV — Key-Value Cache

Session tokens, API response caching, feature flags. Globally distributed key-value store with eventual consistency. We use it where we need fast reads and can tolerate a few seconds of staleness.

7. Vectorize — Embeddings Search

Semantic search across documents, knowledge bases, and content. Used in Perspectiva Studio for contextual content retrieval and in the AI Gateway for intelligent routing decisions.

8. Workers AI — Free Fallback Models

This is our secret weapon for cost control. Workers AI gives us access to Llama 3.x, Mistral, and Phi-3 at zero cost — plus FLUX Schnell and SDXL Lightning for free image generation and Whisper for free STT. About 26% of our AI calls hit Workers AI models at $0. They're not as good as Claude or GPT-4o for complex tasks, but for simple classification, summarization, and fallback scenarios, they're free and fast (0.6s average latency).

9. WAF + DDoS Protection

Automatic for all Workers and Pages deployments. For CIMAD (our healthcare system), this is a compliance requirement — and we get it included without separate configuration or cost.

14+ Products on This Stack

What runs on these 9 Cloudflare products:

  1. Cadences.app — Core SaaS platform (Workers + D1 + R2 + Durable Objects + KV)
  2. CIMAD RIS — Full radiology information system (Workers + Pages + D1 + R2)
  3. AI Gateway — Multi-provider AI router (Workers + D1)
  4. Workflow Engine — Visual automation builder (Workers + Durable Objects + D1)
  5. Nexus — Operations dashboard with God Mode (Workers + D1)
  6. Synapse Studio — AI content creation (D1 + R2 + Workers AI)
  7. Perspectiva Studio — Content management (R2 + D1 + Vectorize)
  8. Heartbeat — Health monitoring engine (Workers + D1)
  9. NutriNen Baby — Nutrition tracking app (Workers + D1 + R2)
  10. VOID Game — Browser game (D1 + Workers + R2)
  11. GoViajes — Travel agency storefront (Pages)
  12. Restaurant23 — Restaurant storefront (Pages)
  13. GoStorm / Codex / Clinica23 — Additional storefronts (Pages)
  14. WhatsApp Agent — Automated messaging (Workers + D1)

All interconnected. The AI Gateway serves AI calls for Cadences, CIMAD, Synapse, and the WhatsApp Agent. The Workflow Engine triggers actions across all products. D1 databases are shared where it makes sense, isolated where it doesn't.

The Cost Breakdown: $65/Month

For our entire workload — ~500K API requests/day, 200GB storage, 60+ endpoints, multiple databases, 14+ products:

☁️ AWS estimated equivalent: $400-600/month (EC2 + RDS + S3 + CloudFront + Route53 + ACM + ALB)

🔶 Cloudflare actual cost: $65/month total

💵 Workers Paid plan: $5/month (covers all Workers + AI Gateway overhead)

🗄️ D1 + R2 usage: ~$60/month (107+ migrations, 200GB stored)

🆓 Pages hosting: $0/month (6 storefronts on free tier)

🆓 Workers AI: $0/month (~26% of all AI calls at zero cost)

That's an 85-90% savings vs. AWS. But the real savings are in what we don't need: no DevOps engineer ($80-120K/year), no infrastructure maintenance time, no scaling anxiety at 3 AM.

Performance: 12ms vs. 80-120ms

Edge computing isn't just cheaper — it's fundamentally faster. When your code runs in 300+ data centers, the user's request hits the nearest one:

P50 API latency: 12ms (vs. 80-120ms on centralized cloud)

🚀 Deploy time: <5 seconds (vs. 5-15 minutes for container deploys)

❄️ Cold starts: 0ms (V8 isolates vs. container spin-up)

🤖 AI Gateway overhead: <5ms per request (routing + logging + fallback logic)

🎨 Workflow canvas: 60fps with 500+ nodes (client-side, Workers handle execution)

12ms P50 latency means our apps feel instant. Not "fast" — instant. The user clicks, the response is there. This matters especially for the workflow editor (real-time saves), the DICOM viewer (progressive image loading), and the AI Gateway (where every millisecond of overhead matters).

Architecture: How 14 Products Share Infrastructure

Cloudflare Workers (60+ endpoints)
  ├── Cadences API       ─┐
  ├── CIMAD RIS API       │
  ├── AI Gateway          ├── All share: D1 databases
  ├── Workflow Engine     │         R2 storage
  ├── Nexus API           │         KV cache
  ├── WhatsApp Agent     ─┘         Auth layer
  └── Heartbeat / NutriNen / VOID

Durable Objects
  ├── Workflow Execution (long-running, stateful)
  ├── WebSocket Hub (real-time updates)
  └── Session Manager

Cloudflare Pages (static, global CDN)
  ├── GoViajes / Restaurant23 / GoStorm
  ├── Codex / Clinica23
  └── CIMAD Public Portal

Workers AI (free tier)
  ├── Llama 3.x (text fallback)
  ├── FLUX Schnell (image generation)
  └── Whisper (speech-to-text)

Vectorize
  └── Semantic search across documents + content

D1 Deep Dive: SQLite in Production

"SQLite in production? Really?" Yes. Here's what we've learned after 107+ migrations:

  • It's fast: Queries execute at the edge, near the user. No network hop to a centralized database cluster
  • It's reliable: SQLite is the most tested database engine in the world (literally — it has more test code than application code)
  • Migrations work: Standard SQL ALTER TABLE, CREATE INDEX, etc. 107+ migrations and counting
  • What works: JOINs, window functions, recursive CTEs, JSON functions, PRAGMA optimizations
  • What doesn't: Advanced full-text search (basic FTS5 only), stored procedures, some PostgreSQL-specific features
  • Our workaround: For semantic search, we use Vectorize. For complex aggregations, we pre-compute in application code. For reporting, we have SQL views (6 views in the AI Gateway alone)

The Trade-offs (Full Transparency)

We're honest about what we gave up:

  • Vendor lock-in: Yes. Our Workers, D1, R2, and Durable Objects code is Cloudflare-specific. But the mitigation is real: business logic is standard TypeScript, database queries are standard SQL, and R2 uses the S3 API. If we had to migrate, ~80% of the code moves directly; only infrastructure glue needs rewriting
  • Worker size limit (1MB compressed): Forces modular architecture. We consider this a feature — it prevents monolith creep. Each Worker is focused, deployable independently
  • No traditional debugging: No SSH, no breakpoints on production. You learn to love structured logging, Durable Object inspectors, and wrangler tail for real-time log streaming
  • D1 scale ceiling: For our workload (healthcare records, AI logs, workflow state), D1 is more than enough. If we hit Netflix-scale traffic, we'd need to reconsider. We're not Netflix
  • Ecosystem maturity: Cloudflare's developer ecosystem is younger than AWS. Fewer third-party integrations, smaller community, less Stack Overflow coverage. When things break, you're sometimes reading source code

Developer Experience: Why Small Teams Win Here

The underrated advantage. Our deploy cycle:

  1. git push to main
  2. GitHub Action runs tests (~45 seconds)
  3. wrangler deploy pushes to production (<5 seconds)
  4. Live worldwide. No staging server, no blue-green deployment, no load balancer drain

Total time from code merge to production: under 60 seconds.

Compare this to a typical AWS deploy: build Docker image (2-3 min), push to ECR (1 min), update ECS task definition (30s), ECS drains old containers and spins new ones (3-5 min), wait for health checks (30s-1 min). Total: 7-10 minutes if nothing goes wrong.

When you deploy 5-10 times per day (we do), those minutes compound into hours of waiting. On Cloudflare, deploys are so fast they don't interrupt your flow.

When NOT to Use Cloudflare

Being honest about where this stack doesn't work:

  • Heavy compute: ML model training, video transcoding, data pipeline processing — Workers have CPU time limits (50ms on free, 30s on paid). These workloads need real servers
  • Large databases: If you need PostgreSQL-level features (PostGIS, complex triggers, materialized views) or multi-TB databases, D1 isn't the answer
  • Compliance-heavy enterprise: Some enterprises require specific cloud certifications (FedRAMP, SOC2 Type II) that Cloudflare may not yet have for all products
  • Real-time streaming: While Durable Objects handle WebSockets well, high-frequency streaming (gaming, financial ticks) may need dedicated infrastructure

The Bottom Line

💰 Monthly infrastructure: $65/month for 14+ products

🌍 Global coverage: 300+ data centers, sub-100ms worldwide

API latency: 12ms P50 (vs. 80-120ms centralized)

🚀 Deploy to production: <60 seconds end-to-end

🗄️ Database migrations: 107+ and counting

👤 DevOps engineers needed: 0

🐳 Docker containers: 0

📟 3 AM pager alerts: 0 (in 2 years)

What We've Learned

  • Simplicity compounds: Every hour not spent on infrastructure is an hour building product. Over two years, we estimate Cloudflare's simplicity saved us 500+ engineering hours compared to running equivalent AWS infrastructure
  • Edge-first changes how you think: When your code runs everywhere, you stop thinking about regions, availability zones, and failover. You just deploy and it works globally. This mental simplicity is hard to quantify but impossible to overstate
  • Free tiers are a strategy: Workers AI free models + Pages free hosting + generous KV free tier = significant portions of our stack cost literally nothing. Build on free tiers where quality is sufficient, pay for premium only where it matters (AI quality, storage volume)
  • The 1MB limit is a feature: Forced modular architecture prevented us from building a monolith. Each Worker is small, focused, independently deployable. When something breaks, the blast radius is one Worker, not the entire platform
  • Lock-in anxiety is overrated: We spent more time worrying about vendor lock-in than it would take to migrate. Standard TypeScript + standard SQL + S3-compatible API = most of our code is portable. The Cloudflare-specific glue is maybe 10-15% of total codebase

Tags

Cloudflare Edge Computing Workers D1 R2 Durable Objects Architecture Serverless

About the Author

Gonzalo Monzón

Gonzalo Monzón

Founder & Lead Architect

Gonzalo Monzón is a Senior Solutions Architect & AI Engineer with over 26 years building mission-critical systems in Healthcare, Industrial Automation, and enterprise AI. Founder of Cadences Lab, he specializes in bridging legacy infrastructure with cutting-edge technology.

Stay in the loop

Get notified when we publish new articles about AI automation, use cases, and practical guides.