Infrastructure for Founders: How to Host Your App for $5/Month
The complete guide to running your SaaS on a $5 VPS with Docker and Coolify. Step-by-step setup.
You don't need Vercel, Railway, or Render to host your app. You need a $5 VPS and an afternoon.
Most solo founders and early-stage startups overpay for hosting by 10x or more. They sign up for managed platforms because they're "easy," then watch their bills climb as they add features and users. Meanwhile, the actual infrastructure cost for a typical early-stage SaaS is about the price of a coffee.
This guide shows you exactly how to set up production-ready hosting for $5/month. No managed platform middlemen. No surprise bills. Just your app running on a VPS you control.
The $5/Month Stack
Here's what you're going to run:
- Hetzner CX11 VPS — €3.29/month (~$3.60), 2 vCPU, 2GB RAM, 20GB SSD
- Docker — containerize your app and services
- Coolify — self-hosted Heroku/Vercel alternative (free, open-source)
- Postgres — your database
- Nginx — reverse proxy and SSL termination
- Cloudflare — free DNS, CDN, and DDoS protection
Total cost: under $5/month for everything. And this stack can handle thousands of concurrent users for most SaaS applications.
Why Hetzner
Hetzner is a German hosting company that offers some of the best price-to-performance VPS instances available. They're not as well-known as DigitalOcean or Linode in the startup world, but the specs speak for themselves.
Hetzner Pricing vs. Competitors
| Provider | Plan | vCPU | RAM | Storage | Monthly Cost |
|---|---|---|---|---|---|
| Hetzner | CX11 | 2 | 2GB | 20GB SSD | €3.29 (~$3.60) |
| Hetzner | CX21 | 2 | 4GB | 40GB SSD | $6.50 |
| DigitalOcean | Basic Droplet | 1 | 1GB | 25GB SSD | $6.00 |
| DigitalOcean | Basic Droplet | 2 | 2GB | 50GB SSD | $12.00 |
| Linode | Nanode | 1 | 1GB | 25GB SSD | $5.00 |
| Vultr | Cloud Compute | 1 | 1GB | 25GB SSD | $6.00 |
Hetzner's CX11 gives you 2 vCPU and 2GB RAM for less than most providers charge for 1 vCPU and 1GB. The performance per dollar is unmatched.
The only downside: Hetzner's data centers are primarily in Germany and Finland. If you need US-based servers, DigitalOcean or Linode might be better choices despite the higher cost.
Step-by-Step Setup
Step 1: Create Your Hetzner VPS
Cost so far: ~$3.60/month.
Step 2: Install Docker and Coolify
SSH into your server and run:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
That's it. Coolify installs Docker, configures Nginx as a reverse proxy, sets up SSL certificates via Let's Encrypt, and gives you a web-based dashboard.
Once it's done, visit http://YOUR_IP:8000 in your browser. You'll see the Coolify setup screen. Create your account and you're ready to deploy.
Coolify is essentially a self-hosted Vercel or Heroku. It handles:
- Automatic SSL certificates
- Docker container management
- Environment variables
- Domain configuration
- Automatic deployments from Git
Step 3: Deploy Your App
In the Coolify dashboard:
Coolify builds your Docker image, starts the container, and configures Nginx to route traffic to it. SSL is automatic. You get a deploy log in real-time.
If your app needs a custom Dockerfile, Coolify supports that too. You can configure build args, multi-stage builds, and volume mounts from the dashboard.
Step 4: Add Your Domain
Step 5: Add a Database
For Postgres, you can either:
Option A: Run Postgres in Docker (recommended for simplicity)In Coolify, add a new resource and select PostgreSQL. Coolify creates a Postgres container with persistent storage. You get a connection string you can use in your app.
Option B: Use Hetzner's managed database (if you need more reliability)Hetzner offers managed Postgres starting at €5.75/month. This gives you automated backups, high availability, and no need to manage the database yourself. But for early-stage apps, Docker Postgres with volume mounts is fine.
Step 6: Set Up Backups
Backups are critical. Here's a simple approach:
0 2 * docker exec postgres-container pg_dump -U postgres mydb > /backups/db-$(date +\%Y\%m\%d).sql
This gives you daily database backups stored off-site. Total cost: still under $5/month.
What You Can Run on a $5 VPS
A Hetzner CX11 (2 vCPU, 2GB RAM) can comfortably run:
- A Node.js/Express or Next.js API server — handles 100-500 concurrent requests depending on your app
- Postgres database — with enough RAM for a decent-sized dataset (up to a few GB)
- Nginx reverse proxy — handles SSL termination and static file serving
- Redis — for caching or session storage (optional, uses ~50MB RAM)
- A background job processor — BullMQ, Celery, or similar
For most SaaS applications with under 10,000 users, this is more than enough. You're not going to hit the limits of a 2 vCPU, 2GB RAM box until your app is generating real revenue.
When to Upgrade
You'll know it's time to upgrade when you see:
- CPU usage consistently above 80%. Use
htopor Coolify's built-in monitoring to check. - Memory usage consistently above 90%. Your app will start swapping to disk, which kills performance.
- Response times increasing. If your API endpoints are taking longer to respond under load, you need more resources.
When that happens, Hetzner's CX21 (2 vCPU, 4GB RAM) is $6.50/month. Hetzner's CX31 (2 vCPU, 8GB RAM) is around $10/month. You can scale vertically without migrating to a different provider.
Managed vs. Self-Hosted: Cost Comparison
Here's what the same stack costs on managed platforms vs. self-hosted on Hetzner:
| Component | Managed Cost | Self-Hosted Cost |
|---|---|---|
| App hosting | $5-20/mo (Railway, Render) | Included in VPS |
| PostgreSQL | $7-15/mo (Supabase, Neon) | Included in VPS |
| SSL/CDN | $0 (Cloudflare free tier) | $0 (Cloudflare free tier) |
| Backups | $2-5/mo | $0 (cron + S3 free tier) |
| Total | $14-40/mo | $3.60-5/mo |
That's a 3-10x cost difference. Over a year, you're saving $100-400. For a bootstrapped founder, that matters.
When Managed Platforms Make Sense
Self-hosting isn't always the right answer. Managed platforms are worth the premium when:
- You're scaling past what a single VPS can handle. If you need load balancing, auto-scaling, and distributed infrastructure, managed platforms save you from building it yourself.
- You need zero-downtime deployments. Some managed platforms handle blue-green deployments and canary releases out of the box. With self-hosted, you'll need to configure this yourself.
- You don't want to be on-call. Managing a VPS means you're responsible for security patches, uptime monitoring, and incident response. Managed platforms handle that for you.
- Your time is worth more than the cost difference. If your hourly rate is $200 and you spend 2 hours/month managing your VPS, that's $400/month of your time. At that point, a $20/month managed platform is cheaper.
But for early-stage founders who are bootstrapping, learning their infrastructure, and watching every dollar — self-hosting is the way to go.
Coolify vs. Other Self-Hosted PaaS Options
Coolify isn't the only option for self-hosted PaaS. Here's how it compares:
Coolify
- Free, open-source
- Web dashboard for managing apps, databases, and domains
- Automatic SSL, Docker builds, Git integration
- Active development and community
- Supports multiple servers (for when you outgrow a single VPS)
CapRover
- Free, open-source
- Simpler than Coolify but less feature-rich
- Good for basic apps that need a Heroku-like experience
- Less active development
Dokku
- Free, open-source
- Git-push deployment (like old Heroku)
- CLI-based, no web dashboard
- Very lightweight, great for minimal setups
- Limited database management
Portainer
- Free community edition
- Docker management GUI, not a full PaaS
- You still need to configure Nginx, SSL, and deployments manually
- Good if you want more control and less abstraction
For most founders, Coolify hits the sweet spot between ease of use and control. It's what Heroku would be if it were free and self-hosted.
Security Considerations
Running your own VPS means you're responsible for security. Here's what you need to do:
SSH Hardening
Disable password authentication and use key-based auth only:
# In /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin prohibit-password
Firewall
Enable UFW and only open the ports you need:
ufw allow 22/tcp # SSH
ufw allow 80/tcp # HTTP
ufw allow 443/tcp # HTTPS
ufw enable
Automatic Updates
Enable unattended security updates:
apt install unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
Fail2Ban
Install Fail2Ban to block brute-force SSH attempts:
apt install fail2ban
systemctl enable fail2ban
These four steps cover 90% of the security baseline you need for a VPS. Coolify handles Docker container isolation and SSL certificates automatically.
The Vibe-Coding Connection
If you're vibe-coding your app with AI tools, there's a good chance the AI suggested a managed platform without you thinking about infrastructure costs. Cursor and Copilot don't think about your hosting bill — they think about what's easiest to generate code for.
That's why you end up with apps deployed on Railway or Render when a $5 VPS would work fine. The AI chose convenience, not cost-efficiency.
This is one of the core problems Mitrix solves. We take vibe-coded projects and restructure them for cost-efficient deployment. Whether that means moving to a VPS, containerizing your app properly, or cleaning up infrastructure code that the AI generated, we make sure you're not overpaying for hosting.
Get a free vibe-code assessment and we'll tell you exactly how much you could save by rearchitecting your deployment.Key Takeaways
- You can run a production SaaS for under $5/month on a Hetzner VPS with Docker and Coolify.
- The $5/month stack includes app hosting, Postgres, SSL, and reverse proxy — everything most apps need.
- Self-hosting saves 3-10x compared to managed platforms like Railway or Render.
- Upgrade to a larger VPS when CPU or memory consistently hits 80-90%.
- Managed platforms make sense when you're scaling past a single server or don't want to manage infrastructure.
FAQ
Can I really run a SaaS on a $5/month VPS?
Yes, for most early-stage apps. A Hetzner CX11 (2 vCPU, 2GB RAM) running Docker with Coolify can handle Node.js/Next.js apps with Postgres for up to thousands of concurrent users. You'll need to upgrade when CPU or memory consistently hits 80-90%, but that typically doesn't happen until you have real traction.
What's the catch with Hetzner?
Hetzner's data centers are primarily in Europe (Germany and Finland). If you need US-based servers for latency reasons, DigitalOcean ($6/month for a similar spec) or Linode are better choices. Hetzner also doesn't have the same ecosystem of managed services (managed Kubernetes, managed Redis, etc.) that larger cloud providers offer.
Is Coolify production-ready?
Yes. Coolify is used by thousands of developers and small companies. It handles SSL certificates, Docker container management, Git-based deployments, and multi-server setups. It's not as battle-tested as Kubernetes or AWS ECS, but for a single-server setup running a SaaS, it's more than adequate.
How do I handle scaling beyond one VPS?
When you outgrow a single server, you have options: (1) upgrade to a larger Hetzner VPS (CX21 for $6.50, CX31 for ~$10), (2) add a second VPS and use Coolify's multi-server support, or (3) migrate to a managed platform like Kubernetes. Most apps don't need to think about this until they're past $10K MRR.
What about managed platforms like Vercel or Railway?
Vercel and Railway are great for getting started quickly, but they're expensive at scale. Vercel's Pro plan is $20/month per team member, and Railway charges based on usage that can spike unpredictably. For a bootstrapped founder watching costs, a $5 VPS with Coolify gives you the same functionality at a fraction of the price.
Spending too much on hosting? Most vibe-coded apps are deployed on managed platforms that cost 3-10x what they should. Get a free vibe-code assessment and we'll show you exactly how much you could save by optimizing your infrastructure.
Need help with your vibe-coded codebase?
Get a free assessment. We'll tell you exactly what needs fixing and in what order.