The Cheapest Infrastructure for a SaaS in 2026
The cheapest workable infrastructure for a SaaS in 2026: exact stack, providers and prices for running a real product for under $5/month.
The cheapest infrastructure that is still workable for a SaaS in 2026 — not a toy, not a free-tier graveyard: a real product with auth, a database and backups for under $5/month.
The concept of “cheapest workable”
Free tiers alone are a trap: they disappear, cap hard, and mix prod/dev. The cheapest workable setup has three properties: it survives a restart, it can be moved, and it costs almost nothing.
The winning combo: Hetzner CX22 + Cloudflare + self-hosted everything
flowchart LR
Users --> CF[Cloudflare Free]
CF --> Caddy[Caddy]
Caddy --> App[App container]
App --> PG[(PostgreSQL)]
App --> Redis[(Redis)]
App --> B2[(B2 backups)]
| Service | Role | Cost |
|---|---|---|
| Hetzner CX22 (2 vCPU / 4 GB / 40 GB) | Everything | $4.49 |
| IPv4 | Public IP | $0.48 |
| Domain | Brand (runcheap-style) | ~$1/mo |
| Cloudflare Free | CDN, TLS, WAF, cache | $0 |
| PostgreSQL (+ Redis) containers | Data + cache | $0 |
| Backblaze B2 + restic | Offsite backups | ~$0.50 |
| Email (Resend Free) | Transactional | $0 |
| Uptime Kuma (same box) | Monitoring | $0 |
| Total | ≈ $5.50/month |
If you already own a domain and skip the IPv4 by using IPv6-only or Cloudflare Tunnels, it drops to ≈ $4.50/month.
Why this wins over free tiers
| Option | Cost | Why it fails |
|---|---|---|
| Supabase Free | $0 | 500 MB DB, pauses if inactive; no custom domain auth on free |
| Railway/Render free | $0 | Sleeps on inactivity; cold starts kill UX |
| Fly.io free | $0 | 3 small instances, but now requires credit card + usage debates |
| Vercel free | $0 | Great for static/frontend only; serverless limits bite |
| Hetzner + self-host | $5.50 | No arbitrary caps — you own the limits |
The deployment (same file everywhere)
docker-compose.yml at the heart of it:
services:
app:
image: ghcr.io/you/saas:latest
restart: unless-stopped
ports: ["3000:3000"]
env_file: .env
db:
image: postgres:17:17
restart: unless-stopped
volumes: ["pgdata:/var/lib/postgresql/data"]
redis:
image: redis:7
restart: unless-stopped
Backup job (cron on the host):
0 2 * * * restic -r b2:you-bucket:saas backup /var/lib/docker/volumes
Guardrails to stay under $5
- No managed services. Managed Postgres/Redis/monitoring is how costs triple. Self-host all three.
- One region, one box. Multi-region and HA are future-you’s problem; the data backs up offsite today.
- Cloudflare for the edge. CDN, TLS, WAF and bot filtering for free — that’s the one “managed” thing that pays for itself.
- Audit every bill monthly. One forgotten extra IP or snapshot doubles this budget.
When it stops being enough
- PostgreSQL CPU sustained >60%
- RAM pressure reaching the OOM killer
- Backups >10 GB (restic time creeping up)
Upgrade order (each step keeps the same Compose file): CX22 → CX32 ($8.49) → split DB to its own CX22 → CDN-served static assets. Revenue-first, hardware-second — never pre-buy a bigger box for a hypothetical spike.
Production checklist
- Offsite encrypted backups (restic → B2), restore test monthly
- Uptime Kuma watchdog hitting
/healthz - Cloudflare caching for static paths
- Firewall: 80/443 + SSH only
- Automatic security updates
Common problems
- The $0 setup that costs $50 in ops: free tiers shift cost into engineering time. A $5.50 VPS is the opposite — all the controls, none of the babysitting.
- IPv6-only optimism: some email providers and APIs still fail on IPv6-only egress. Pay the $0.48.
- No monitoring: cheap infra fails silently. Uptime Kuma on the same box costs nothing and alerts loudly.
Conclusion
The cheapest workable SaaS infrastructure in 2026 is a Hetzner CX22 with self-hosted Postgres, Redis and Caddy behind Cloudflare, with offsite restic backups — about $5.50/month, zero arbitrary caps and a migration path that never re-architects.