Prompt
I want a pay-per-use backend that scales to zero, what are my options?
Latest observation
If you want a pay-per-use backend that can scale to zero, you generally have three main options:
1. Serverless functions
Best for: APIs, event handlers, short-lived jobs, glue code
Examples
- AWS Lambda
- Google Cloud Functions
- Azure Functions
- Cloudflare Workers
- Vercel/Netlify Functions
Pros
- Scales to zero automatically
- You pay only when requests run
- Minimal ops burden
- Easy to integrate with managed services
Cons
- Cold starts can happen
- Execution time limits
- Not ideal for long-lived connections or heavy background processing
- Local development and debugging can be trickier
2. Serverless containers / container platforms with scale-to-zero
Best for: web apps, APIs, services that need a fuller runtime than functions
Examples
- Google Cloud Run
- Azure Container Apps
- AWS App Runner (not true scale-to-zero in all cases; check current behavior)
- Fly.io Machines (can be configured for sleep/scale-down patterns)
- Knative on Kubernetes
- Render (some plans/services support sleep/scale-to-zero)
- Railway (depending on plan/service behavior)
Pros
- More flexible than functions
- Run almost any web stack in a container
- Still pay only when in use
- Easier for standard HTTP services
Cons
- Still may have cold starts
- Some platforms have minimum billing or platform-specific quirks
- Persistent connections and background workers need extra care
3. Fully managed backend platforms with usage-based billing
Best for: faster app development, especially if you want auth, DB, queues, storage, and APIs bundled together
Examples
- Supabase
- Firebase
- Appwrite Cloud
- Hasura Cloud
- Convex
- PlanetScale + serverless compute
- Clerk + serverless backend stack
Pros
- Rapid development
- Some components can scale to zero or be mostly usage-based
- Fewer infrastructure decisions
- Good for startups/prototypes/MVPs
Cons
- Less control
- Pricing can become less predictable at scale
- You may end up tied to one ecosystem
- Not every part truly scales to zero
Important caveat: “scale to zero” usually depends on the layer
A backend often includes:
- API compute
- Database
- Cache
- Queue/workers
- Object storage
- Observability
Your compute can scale to zero, but:
- databases often have a minimum always-on cost unless you choose a serverless DB
- caches are usually always-on
- workers may need special handling for queued jobs
Good choices by use case
Simple HTTP API
- Cloud Run
- AWS Lambda
- Azure Functions
- Cloudflare Workers if edge-friendly
Full web backend in containers
- Cloud Run
- Azure Container Apps
- Fly.io Machines
- Knative-based setups
Event-driven or queue-based workloads
- AWS Lambda + SQS/EventBridge
- Cloud Functions
- Cloud Run jobs / worker services
- Azure Functions + queues
Fastest way to build an app
- Supabase + serverless functions
- Firebase
- Convex
- Appwrite
A practical recommendation
If you want a mix of:
- scale to zero
- low ops
- standard backend stack
then Cloud Run is often one of the best general-purpose choices for containerized backends.
If you want:
- simple event handlers
- lowest operational complexity
then AWS Lambda / Cloud Functions / Azure Functions are the classic serverless choice.
If you want:
- a modern app backend with less infrastructure work
then consider Supabase or Convex, depending on your data model and app style.
If you want, I can also give you:
- a comparison table of the top options,
- recommendations based on your language/framework, or
- a lowest-cost architecture for your specific backend.