supabase deployment
How to build rock-solid applications with Fly.io and Supabase. Architecture patterns, deployment strategies, and common pitfalls.
Fly.io and Supabase together form a powerful stack for building global applications. But getting reliability right requires understanding their operational characteristics.
Fly.io gives you globally distributed compute with Machines that boot in milliseconds. Supabase provides Postgres with real-time capabilities and built-in auth. Together: fast, simple, and scalable.
Deploy Fly Machines in the same region as your Supabase instance. Network latency between compute and database kills performance.
# fly.toml
primary_region = "sjc" # Same as Supabase
min_machines_running = 1 # Prevent cold starts
auto_stop_machines = false
Use Supabase's connection pooler in transaction mode. Don't open connections directly to Postgres from every Machine.
DATABASE_URL=postgres://...supabase.co:6543/postgres
# Port 6543 = Pooler in transaction mode
For read-heavy workloads, deploy Fly Machines near users and use Supabase read replicas. Keep writes regional, spread reads globally.
Fly auto-stops idle Machines by default. For user-facing apps, keep at least 1 Machine running. The cost is minimal, the UX gain is massive.
Supabase free tier: 60 connections. If your Machines don't pool properly, you'll hit limits fast. Monitor pg_stat_activity.
Machines are ephemeral. Use Fly Volumes for persistent storage. Back them up regularly - volumes aren't replicated.
Key metrics to track:
This stack is production-ready out of the box, but reliability comes from understanding the operational details.
Reliability and SEO sit on the same Core Web Vitals foundations: p95 response time, cold-start behaviour, and database query latency all show up in Google's field data. A technical SEO audit ties those infrastructure metrics back to rankings, indexability, and AI search readiness.