Prompt
Fly.io vs Cloudflare Workers for running app logic closer to users
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
If your goal is running app logic closer to users, the tradeoff is basically:
- Cloudflare Workers = best for edge-native, ultra-low-latency, stateless logic
- Fly.io = best for full apps/services close to users, especially when you need real servers, state, networking flexibility, or long-lived processes
Quick rule of thumb
Choose Cloudflare Workers if:
- your code is mostly request/response
- you want global edge deployment by default
- you need very fast cold starts and low latency
- you can live within a serverless edge runtime
- you’re building:
- API gateways
- auth/session handling
- lightweight personalization
- caching logic
- middleware
- content transformation
- webhook handlers
Choose Fly.io if:
- you need containers/VM-like freedom
- your app needs stateful services, background workers, websockets, or custom networking
- you want to run a full backend stack close to users
- you’re building:
- APIs with heavier runtime needs
- Postgres-adjacent apps
- long-running processes
- WebSocket apps
- apps that depend on native binaries or specific OS behavior
Main differences
1) Runtime model
Cloudflare Workers
- Runs in a restricted JavaScript/TypeScript runtime (with some other language support via WASM / tooling)
- Designed for short-lived, stateless edge execution
- Very fast startup and request handling
Fly.io
- Runs your app in containers on their global VM platform
- Much closer to “real server deployment”
- More flexible for frameworks, binaries, and background jobs
2) Global presence
Cloudflare Workers
- Extremely broad edge network
- Requests are handled very close to the user almost everywhere
- Usually the strongest option if “closest possible” is the top priority
Fly.io
- Deploys apps in regions you choose; can spread instances globally
- Good latency improvements, but not as universally edge-distributed as Cloudflare
3) State and persistence
Cloudflare Workers
- Stateless by default
- Can use edge storage products, but architecture is more distributed and constrained
- Not ideal for traditional stateful server patterns
Fly.io
- Better fit for apps needing disk, persistent volumes, databases, or classic server workflows
- Easier if your app expects a normal Linux environment
4) Developer experience
Cloudflare Workers
- Great for small, composable edge functions
- Can feel limiting if you’re used to Node/server environments
- Best when you design around platform constraints
Fly.io
- Easier migration path for existing apps
- More familiar if you already have Dockerized services
- Less “rewrite your architecture” pressure
Latency perspective
If the specific question is “How do I get logic closest to users?”, Cloudflare Workers usually wins on raw edge proximity.
But if your app needs:
- database access in a particular region
- more complex backend behavior
- service-to-service communication
- custom libraries or OS-level support
then Fly.io may give better end-to-end performance even if it’s not as far out on the edge, because it lets you place app instances intelligently and avoid fighting runtime limits.
Best-fit scenarios
Use Cloudflare Workers for:
- BFFs (backend-for-frontend)
- auth/session checks
- request routing
- A/B testing
- image/header rewriting
- lightweight APIs
- edge caching and personalization
Use Fly.io for:
- monoliths you want to run globally
- API services with heavier dependencies
- realtime apps and websockets
- background jobs
- apps needing Postgres, Redis, queues, or local disk
- “I want Kubernetes-ish flexibility without Kubernetes”
Practical recommendation
- If you’re building edge logic, start with Cloudflare Workers
- If you’re building a real app backend that benefits from being nearer to users, start with Fly.io
- If you want the best of both:
- put latency-sensitive edge logic on Cloudflare Workers
- keep core app services on Fly.io
If you want, I can also give you:
- a decision matrix,
- a cost comparison, or
- a recommended architecture for your specific app.