Fly.io vs Cloudflare — When You Need Real Servers vs Global Edge
Fly.io gives you actual servers anywhere; Cloudflare gives you a global edge network. Pick based on whether you need compute or distribution.
The short answer
Fly.io over Cloudflare for most cases. Fly.io wins because it lets you run full-stack apps on real servers in 30+ regions with zero cold starts.
- Pick Fly.io if building a traditional web app with databases or need zero cold starts — think SaaS products, real-time apps, or anything that isn't purely request-response
- Pick Cloudflare if enhancing a static site, building lightweight APIs, or need to run code within milliseconds of users worldwide — think JAMstack, middleware, or CDN logic
- Also consider: **Vercel** if you're all-in on Next.js and want a simpler deployment than Fly.io, but beware of serverless limitations.
— Nice Pick, opinionated tool recommendations
This Isn't a Fair Fight — It's Compute vs Distribution
Most comparisons try to pit these as direct competitors, but that's like comparing a Swiss Army knife to a scalpel. Fly.io is a platform for deploying full applications with persistent state — think Rails apps, Postgres databases, or WebSocket servers. Cloudflare Workers is an edge computing platform designed for stateless functions that run close to users. If you're trying to decide between them, you're probably asking the wrong question: do you need servers or edge functions?
The confusion comes because both talk about "global deployment," but Fly.io's "global" means running your Docker containers on actual VMs in physical locations worldwide. Cloudflare's "global" means your JavaScript functions run on their edge network in 300+ cities. One gives you infrastructure, the other gives you distribution. Getting this wrong means either overpaying for edge functions you don't need or hitting walls when your "serverless" function tries to handle state.
Where Fly.io Wins — Full Applications with Persistent State
Fly.io dominates when you need real servers without the cloud complexity. Their magic is running Docker containers as lightweight VMs (Firecracker microVMs) that deploy in seconds to any region. Need a Postgres database in Singapore? Fly.io lets you spin it up with fly postgres create. Need to run a WebSocket server that maintains connections for hours? Fly.io's machines stay warm.
Their pricing model is brutally simple: $1.94 per shared CPU core per month plus $0.02 per GB-hour of RAM. A 2GB RAM, 1 vCPU instance costs about $35/month. Compare that to Cloudflare Workers where you're paying per request and execution time — once your app has steady traffic, Fly.io is cheaper. Plus, Fly.io gives you volumes for persistent storage, something Cloudflare Workers explicitly avoid. If your app needs files, databases, or long-running processes, Fly.io is the only option.
Where Cloudflare Holds Its Own — Edge Functions at Scale
Cloudflare Workers shines when you need JavaScript functions at the edge — think authentication, A/B testing, or API routing. Their network spans 300+ cities, so your code runs within milliseconds of users worldwide. For stateless tasks like modifying responses, handling webhooks, or serving static sites, Workers is unbeatable.
Their free tier is generous: 100,000 requests per day and 10ms CPU time per request. Paid plans start at $5/month for 10 million requests. If you're building a JAMstack site or need to offload logic from your origin server, Workers is perfect. Their KV storage and Durable Objects offer limited state, but they're not replacements for databases. Cloudflare also bundles CDN, DNS, and security — if you're already using their suite, Workers integrates seamlessly.
The Gotcha — Cold Starts vs State Limitations
Fly.io's biggest advantage is zero cold starts — your machines run continuously, so requests hit instantly. Cloudflare Workers can have cold starts if your function hasn't been invoked recently, though they're typically under 5ms. The real gotcha is state: try storing session data in a Worker and you'll hit walls. Durable Objects help but are expensive and complex.
Switching costs matter too. Migrating from Fly.io to another cloud means moving Docker containers — straightforward. Migrating from Cloudflare Workers means rewriting your functions for a new serverless platform. And don't forget: Fly.io's flyctl CLI feels like Heroku reborn, while Cloudflare's Wrangler is fine but tied to their ecosystem. If you outgrow Workers, you're rebuilding; if you outgrow Fly.io, you're just moving containers.
If You're Starting Today — Pick Based on Your Stack
Choose Fly.io if: You're building a traditional web app (Rails, Django, Node.js with databases), need persistent storage, or hate cold starts. Deploy with fly launch and you've got a global app in minutes. Their free tier includes 3 shared VMs with 256MB RAM — enough for prototypes.
Choose Cloudflare Workers if: You're enhancing a static site, building API gateways, or need logic at the edge. Use it with Cloudflare Pages for a full JAMstack setup. But if you find yourself reaching for Durable Objects, stop — you probably need Fly.io.
Most projects should start with Fly.io because it doesn't limit your architecture. Workers force you into serverless patterns that can become technical debt. Fly.io lets you scale from a single VM to a globally distributed app without rewriting.
What Most Comparisons Get Wrong — It's Not About Price
Everyone obsesses over pricing, but the real difference is architectural freedom. Fly.io gives you VMs — you can run anything, even legacy apps. Cloudflare Workers locks you into their runtime (V8 isolates). Yes, Workers is cheaper for low-traffic functions, but price Fly.io against AWS ECS or Heroku and it's 50% cheaper.
The other miss: latency vs locality. Workers reduce latency by running code everywhere, but Fly.io reduces latency by running your full app closer to users. For database-heavy apps, having your app and database in the same Fly.io region beats edge functions talking to a distant origin. Don't choose based on marketing — choose based on whether you need computers or distribution.
Quick Comparison
| Factor | Fly.io | Cloudflare |
|---|---|---|
| Compute Model | Docker containers on Firecracker microVMs (persistent) | JavaScript functions on V8 isolates (stateless) |
| Pricing for 1M Requests | $35/month (2GB RAM, 1 vCPU instance — flat rate) | $5/month (10M requests included — usage-based) |
| Free Tier | 3 shared VMs, 256MB RAM each, 3GB storage | 100k requests/day, 10ms CPU/request |
| Persistent Storage | Volumes (SSD), managed Postgres | KV (key-value), Durable Objects (limited) |
| Global Regions | 30+ regions (actual VMs) | 300+ cities (edge points) |
| Cold Starts | None (machines run continuously) | <5ms (functions may idle) |
| Best For | Full-stack apps, databases, WebSockets | Edge functions, static sites, API routing |
| Learning Curve | Medium (Docker, flyctl CLI) | Low (JavaScript, Wrangler CLI) |
The Verdict
Use Fly.io if: You're building a traditional web app with databases or need zero cold starts — think SaaS products, real-time apps, or anything that isn't purely request-response.
Use Cloudflare if: You're enhancing a static site, building lightweight APIs, or need to run code within milliseconds of users worldwide — think JAMstack, middleware, or CDN logic.
Consider: **Vercel** if you're all-in on Next.js and want a simpler deployment than Fly.io, but beware of serverless limitations.
Fly.io wins because it lets you run full-stack apps on real servers in 30+ regions with zero cold starts. Cloudflare Workers are great for edge functions, but if you need persistent processes, databases, or Docker containers, Fly.io is the only choice.
Related Comparisons
Disagree? nice@nicepick.dev