Fly.io
Run your apps close to your users
Deploy Docker containers globally across 35+ regions. Run your backend, database, and apps close to users worldwide for ultra-low latency.
Fly.io runs your Docker containers in data centers around the world. Your app runs in Tokyo for Tokyo users, London for London users. Global by default.
Why Use Fly.io
Global by Default: Deploy to 35+ regions worldwide with one command. Your app runs close to users, reducing latency from 500ms to 50ms.
Run Anything: If it runs in Docker, it runs on Fly. Node, Python, Elixir, Rust, Go - any language, any framework. Full control over your environment.
Persistent Storage: Unlike serverless platforms, Fly offers persistent volumes. Run databases, store files, keep state between deploys.
Edge Databases: Fly's distributed Postgres means your database runs near your users too. Not just your app, but your data.
Key Features
- 35+ Global Regions - Deploy close to users worldwide
- Docker Native - Run any containerized app
- Anycast Networking - Route users to nearest region automatically
- Persistent Volumes - Store data that survives deploys
- Fly Machines - Firecracker microVMs that start in milliseconds
- Private Networking - IPv6 private network between apps
- Fly Postgres - Distributed Postgres clusters
- Metrics & Logs - Built-in monitoring
- Auto-scaling - Scale instances based on traffic
- Load Balancing - Automatic across regions
Pricing for Solo Builders
Free Allowances:
- 3 shared-cpu VMs with 256MB RAM
- 3GB persistent storage
- 160GB outbound data transfer
- Perfect for side projects
Paid (Usage-based):
- Shared CPU: $0.0000017 per second (~$5/month per VM)
- Dedicated CPU: $0.00001 per second (~$30/month per vCPU)
- Storage: $0.15 per GB/month
- Data transfer: $0.02 per GB
Most solo projects: $5-20/month
Perfect For
- Global applications (users worldwide)
- Low-latency requirements
- Backend APIs and services
- Non-Node.js apps (Elixir, Rust, Go)
- Apps needing persistent storage
- Databases and stateful services
- Websocket servers
- Real-time applications
Fly.io vs Vercel
Choose Fly.io if you:
- Need true global deployment
- Run non-JavaScript backends
- Need persistent storage/state
- Want to run databases
- Need sub-50ms latency globally
- Use Docker containers
Choose Vercel if you:
- Building Next.js apps
- Only need frontend + API routes
- Don't need state/storage
- Want simpler deployment
Fly is for backends and global apps. Vercel is for frontends.
Deploy Your First App
# Install flyctl CLI curl -L https://fly.io/install.sh | sh # Login fly auth login # Create Dockerfile (or use existing) # Deploy fly launch # App is live in multiple regions!
Fly detects your language, suggests Dockerfile, and deploys globally.
Global Regions
Deploy to any/all of these regions:
- Americas: US East/West, Canada, Brazil, Argentina
- Europe: London, Frankfurt, Paris, Amsterdam, Warsaw
- Asia: Tokyo, Singapore, Hong Kong, Sydney, Mumbai
- Africa: Johannesburg
Your app runs in all selected regions simultaneously.
Anycast Routing
Magic networking:
- One domain (yourapp.fly.dev)
- Users automatically routed to nearest region
- If a region fails, traffic routes to next closest
- No CDN needed - your app IS the edge
Fly Machines
Firecracker microVMs that:
- Start in milliseconds (not seconds)
- Stop when idle (save money)
- Auto-scale based on traffic
- Run full Linux environments
Like serverless, but with persistent storage and full control.
Persistent Volumes
Unlike serverless platforms, Fly offers persistent storage:
# Create volume fly volumes create myapp_data --size 10 # Mount in fly.toml [mounts] source = "myapp_data" destination = "/data"
Data persists across deploys and restarts.
Run Your Database
Deploy Postgres, Redis, or any database:
# Create Postgres cluster fly postgres create # Attach to app fly postgres attach my-postgres # Database runs in multiple regions # Replicas in each region for low latency
Or run any database in Docker.
Example: Global API
# Deploy FastAPI backend fly launch --name global-api # Scale to multiple regions fly scale count 3 --region ams,lax,sin # Amsterdam, Los Angeles, Singapore users get <50ms latency
Fly.toml Configuration
app = "myapp"
[build]
dockerfile = "Dockerfile"
[[services]]
internal_port = 8080
protocol = "tcp"
[[services.ports]]
port = 80
handlers = ["http"]
[[services.ports]]
port = 443
handlers = ["tls", "http"]
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true # Stop when idle
auto_start_machines = true # Start on request
[[vm]]
memory = '256mb'
cpu_kind = 'shared'
cpus = 1
Private Networking
All your Fly apps get IPv6 private network:
- Apps communicate without public internet
- Secure by default
- No firewall rules needed
Perfect for microservices.
Secrets Management
# Set secrets fly secrets set API_KEY=secret # Available as environment variables # Encrypted at rest
Logs and Monitoring
# View logs fly logs # Real-time fly logs -f # Metrics fly dashboard metrics
Auto-scaling
Scale based on traffic:
[http_service] auto_stop_machines = true # Stop when no traffic auto_start_machines = true # Start when requests arrive min_machines_running = 1 # Keep at least 1 running
Pay only when serving traffic.
Deployment Strategies
Zero-downtime deploys:
- Deploy new version
- Health check passes
- New version starts serving traffic
- Old version shuts down
Automatic, no configuration.
Framework Support
Works with anything:
- Next.js, Remix, SvelteKit - Full-stack JS
- Django, Flask, FastAPI - Python
- Rails, Sinatra - Ruby
- Phoenix - Elixir (Fly's founders love Elixir)
- Go, Rust - Native binaries
- Any Dockerfile
The Elixir Connection
Fly's founders are Elixir developers. Fly is optimized for Elixir/Phoenix apps but works great with any language.
Phoenix apps get special treatment (LiveView, distributed clustering) but it's not required.
Fly Postgres
Distributed Postgres with:
- Leader in primary region
- Replicas in other regions
- Automatic failover
- Read replicas close to users
fly postgres create --name mydb fly postgres attach mydb --app myapp
Better than managed Postgres for global apps.
Use Cases
Global API:
- Deploy to 5+ regions
- Sub-50ms latency worldwide
- Auto-scale by region
Real-time Chat:
- Websocket connections
- Persistent state
- Global deployment
Backend for Mobile App:
- Users in US, Europe, Asia
- Low latency API responses
- Database replicas globally
Fly vs Railway
Choose Fly if you:
- Need global deployment
- Want sub-100ms latency worldwide
- Run stateful services
- Use non-JS languages heavily
Choose Railway if you:
- Want beautiful dashboard (Railway's is prettier)
- Deploy to one region is fine
- Prefer simpler mental model
- Don't need global distribution
Both are great. Fly is more powerful, Railway is more polished.
Limitations
What Fly doesn't do well:
- Frontend hosting (use Vercel)
- Cheapest static sites (use Cloudflare Pages)
- One-click databases (more DIY than Railway)
- Beginner-friendly (steeper learning curve)
Cost Optimization
Save money:
- Use auto-stop/auto-start machines
- Deploy fewer regions initially
- Use shared CPUs (cheaper)
- Monitor usage in dashboard
Free tier is generous for learning/experimenting.
Tips for Solo Builders
- Start with 1-2 regions, scale globally later
- Use auto-stop machines for low-traffic apps
- Run database on Fly (cheaper than managed services)
- Combine with Vercel (Fly for API, Vercel for frontend)
- Enable metrics to understand usage
- Use volumes for persistent data
- Join Fly.io community forum (helpful!)
Migration Path
From Heroku:
- Fly is natural Heroku successor
- Similar deployment model (Dockerfile)
- Better pricing, more control
From Vercel/Netlify:
- Move your API to Fly
- Keep frontend on Vercel
- Get global API with persistent storage
The Verdict
Fly.io is the best way to deploy apps globally. If you have users worldwide, Fly's anycast routing and multi-region deployment make your app fast everywhere.
The free tier is perfect for side projects. The pricing is usage-based and reasonable. The technology (Firecracker VMs) is cutting-edge.
For solo builders who need more than frontend hosting, Fly competes with Railway. Choose Fly if you need global deployment or Elixir/Phoenix. Choose Railway if you want prettier UX and don't need multi-region.
The learning curve is steeper than Vercel, but the power is worth it. You get full control over your environment, persistent storage, and true global deployment.
If you're building a backend API, mobile app backend, or anything that needs low latency globally, Fly.io is hard to beat.