VPSDockerCaddyCloudflareHostingSelf-HostingArchitekturaAugust 14, 20268 min read

Why I Host My Web Apps on a VPS Instead of Vercel

ZP

Zeno Partyka

Backend & Systems Developer

Platforms like Vercel have done an outstanding job popularizing one-click deployments, and for many teams, they represent an excellent way to eliminate infrastructure overhead. However, when building my own projects and client solutions with relational databases, caches, and persistent processes, I prefer running on a self-hosted VPS with Docker and Caddy. It is not about VPS being magically superior — it is a choice between two distinct paths: on one hand, the hands-off convenience of a managed platform; on the other, the full control, flexibility, and predictable costs of running your own server.

1. Everything Together: Docker Stack with DB & Redis (and SPOF Awareness)

My standard deployment model defines the entire application stack in a single `docker-compose.yml` file. Running in unison:

• The web application (Next.js or FastAPI backend)

• Relational database (PostgreSQL with persistent volume storage)

• In-memory store (Redis for sessions, cache, and task queues)

All services communicate over an isolated internal Docker network, which eliminates traffic over the public internet and typically delivers very low latency between services.

This containerized stack is ideal for solo projects, MVPs, client applications, and small SaaS platforms. For systems with high availability requirements, distributing infrastructure across multiple nodes with redundant components and managed databases is appropriate, as a single standalone VPS is inherently a single point of failure (SPOF).

Key Takeaways

  • The full stack (Web + DB + Redis) operates inside an isolated, lightning-fast internal network
  • Consistent environment: the same Docker Compose stack can be used for both local development and deployment
  • A pragmatic approach for MVPs with an emphasis on disciplined automated backups

2. Serverless Limits vs. Managing Your Own Resources

Serverless platforms are built around request-response lifecycles with predefined runtime constraints and execution timeouts. Running continuous background workers, scheduled syncs, or heavy task queues often requires third-party services and additional configuration overhead.

On a VPS, typical serverless execution limits do not apply. Instead, you take responsibility for the capacity and reliability of your own infrastructure:

• Background Workers & Cron: Persistent tasks and worker queues (BullMQ / Celery) run naturally as continuous background processes without fear of premature termination.

• WebSockets & Real-Time: A VPS allows running long-lived WebSocket connections without serverless execution timeouts, though connection scaling and availability remain the operator's responsibility.

• Real Machine Limits: A VPS naturally has its own capacity limits — CPU, RAM, disk IOPS, and network throughput. However, on well-engineered, optimized applications, an affordable VPS comfortably handles surprisingly high workloads.

Key Advantages
  • •No serverless execution timeouts on background processes and worker queues
  • •Native support for WebSockets and persistent TCP connections
  • •Allocated system resources under your direct control
Pitfalls & Risks
  • •A single VPS is fundamentally a single point of failure without built-in redundancy
  • •Full operational responsibility for monitoring, backups, and OS security patches

3. Multiple Projects on One VPS: Caddy and Cloudflare in Production

Another benefit is the flexibility of scaling project counts. A single VPS can effortlessly host multiple independent web applications and APIs in isolated containers.

I use Caddy as the reverse proxy connected to a shared Docker network. Adding a new project is straightforward: launch the container and append a routing block to the `Caddyfile`.

When combining Caddy with Cloudflare Proxy (orange cloud), two technical nuances are worth addressing:

• Real Client IP Resolution: For accurate access logging and rate limiting, Caddy should be configured with `trusted_proxies` for Cloudflare's IP ranges so it extracts `CF-Connecting-IP` rather than the proxy node's IP.

• SSL / TLS Certificates: To prevent ACME HTTP-01 challenge friction behind Cloudflare proxy, using a Cloudflare Origin Certificate on Caddy or Caddy's DNS-challenge plugin with a scoped Cloudflare API token is the cleanest solution.

Caddyfile (Multi-project Docker network example)
caddyfile
partyka.pro {
    reverse_proxy partyka-web:3000
}

example.com {
    reverse_proxy example-app:3000
}

app.example.com {
    reverse_proxy app-backend:8000
}

4. Deployment Workflow: From Git Push to Production Container

A common critique of self-hosting is losing the seamless 'git push to deploy' workflow. Manual SSH logins and running commands by hand do not belong in a serious production environment.

My deployment pipeline is fully automated using GitHub Actions:

1. Git Push: Pushing changes to `main` triggers automated testing and builds an optimized Docker image.

2. Registry: The built image is pushed to a container registry (GitHub Packages or Docker Hub).

3. Automated Deploy: The action connects to the VPS via a secure SSH key, executes `docker compose pull`, and restarts the running container (`docker compose up -d --remove-orphans`) with zero hassle.

This provides the exact same developer convenience as Vercel — you push code, and the new version goes live automatically, all while avoiding vendor lock-in.

Key Takeaways

  • Fully automated CI/CD via GitHub Actions with zero manual server interventions
  • Builds execute on GitHub runners, keeping VPS CPU and RAM completely free for user traffic
  • Version-tagged Docker images enable instant rollbacks if a regression occurs

5. Predictable Economics: Affordable VPS + Cloudflare

The pricing model of platforms like Vercel is accessible initially, but as resource consumption grows, costs can escalate significantly (team seats, bandwidth egress, middleware charges, and separate managed databases).

Instead, I host on a local Czech VPS provider. For just a few dollars a month, I get:

• More than enough RAM and fast CPU cores to comfortably power all my running applications

• High-speed network connectivity and unlimited data transfer with zero hidden fees

• Physical hardware located directly in the Czech Republic for ultra-low domestic latency

• Web server, PostgreSQL, and Redis running together on the same machine

When paired with Cloudflare as a global CDN and DNS proxy for static assets and cacheable responses, international visitors experience fast load times while backend data remains on a domestic server at a fixed, transparent rate.

Key Takeaways

  • Low fixed monthly costs (ample RAM, CPU, and unlimited data transfer)
  • Cloudflare as an efficient CDN layer for static assets and DNS proxying
  • Completely predictable monthly costs with zero billing surprises

6. The Real Trade-Off & Practical Backup Strategy

Vercel does not just sell hosting — it sells the elimination of operational work. It provides managed infrastructure, automated deployments, and, depending on configuration, global distribution and scaling without OS management overhead.

On a VPS, operational responsibility is yours. The single most important element is database persistence, which is easily handled with a disciplined workflow:

• Automated Nightly Dumps: A scheduled cron task executes `pg_dump`, encrypting and compressing the database dump.

• Offsite Storage Sync: The encrypted archive is immediately synced offsite to S3-compatible cloud storage (Cloudflare R2 or Backblaze B2) with automated retention policies.

• Disaster Recovery Drills: Periodically verifying that a backup can actually be restored locally ensures real data safety.

For my personal projects, MVPs, and client solutions, this setup offers complete ownership, transparent costs, and peace of mind.

Final Takeaway

Choosing between a VPS and Vercel is not about which is universally superior, but which operational model aligns with your goals. If you need rapid deployment with zero server maintenance, Vercel is outstanding. If you are building full-stack applications with databases, caching, and background workers and value predictable costs and full architectural control, a self-hosted VPS with Docker is a battle-tested, pragmatic path.

💡 For new projects and growing SaaS products, consider a VPS as a cost-effective, flexible foundation. Just ensure you implement automated database backups from day one — and remember that a backup isn't truly a backup until you've tested that you can restore it.

ZP

Zeno Partyka

Backend & Systems Developer

Engineer specializing in robust architectures, scalable backend systems, and modern full-stack engineering.

Send a Message