Self-Hosted Alternatives to Heroku

Why Replace Heroku?

Heroku killed its free tier in November 2022. The cheapest option is now $5/month per dyno (Basic), which sleeps after 30 minutes of inactivity. Eco dynos cost $5/month for a pool of 1,000 hours across all apps — barely enough for one always-on app. The Hobby tier ($7/month per dyno) doesn’t sleep but has no horizontal scaling. Production-grade dynos start at $25/month each.

For a modest deployment — say, three small web apps, two workers, and a PostgreSQL database — you’re looking at $50-100+/month on Heroku. The same workload runs comfortably on a $5-15/month VPS with a self-hosted PaaS.

Heroku’s convenience was always its selling point: git push heroku main and your app deploys. Self-hosted PaaS tools now replicate this workflow on your own infrastructure.

FeatureHeroku (Basic)Self-Hosted (Coolify/Dokku)
Cost (3 apps)$15-21/month (dynos only)$5-15/month (entire VPS)
Cost (3 apps + database)$20-30/month$5-15/month (same VPS)
Database included$5/month (10K rows)Free (PostgreSQL on same server)
Sleep on inactivityYes (Basic)No
Custom domainsYesYes
SSL certificatesAutomaticAutomatic (Let’s Encrypt)
Git push deployYesYes
BuildpacksYesYes (Dokku/Coolify)
Docker supportYesYes
Horizontal scalingPaid tiers onlyManual (add more servers)

Best Alternatives

Coolify — Best Overall Replacement

Coolify is a self-hosted Heroku/Vercel/Netlify alternative with a modern web UI. It supports deploying from Git repositories, Docker images, or Docker Compose files. It handles SSL certificates, reverse proxying, database provisioning, and zero-downtime deployments — all through a clean dashboard.

Coolify supports multiple deployment targets (your own servers connected via SSH), making it suitable for managing applications across several VPS instances from a single interface.

FeatureHerokuCoolify
Deploy from GitYesYes (GitHub, GitLab, Bitbucket)
Docker supportYesYes (images + Compose)
One-click databasesPostgreSQL, Redis, MongoDBPostgreSQL, MySQL, MariaDB, MongoDB, Redis
Environment variablesDashboard + CLIDashboard + API
SSL/TLSAutomaticAutomatic (Let’s Encrypt, Traefik)
WebhooksYesYes (auto-deploy on push)
Team managementYesYes
Resource monitoringMetrics tabBuilt-in per-service metrics
LicenseProprietaryAGPL-3.0

Best for: Teams wanting a visual dashboard for deploying multiple applications. Closest UX to Heroku.

Dokku — Best for Solo Developers

Dokku is the original self-hosted PaaS — “Docker-powered mini-Heroku.” It uses Heroku’s own buildpacks, so most Heroku apps deploy to Dokku with zero changes. The workflow is identical: git push dokku main triggers a build and deploy.

Dokku is CLI-driven (no web UI) and runs on a single server. It’s lightweight, battle-tested, and has an extensive plugin ecosystem for databases, caching, cron jobs, and more.

FeatureHerokuDokku
Deploy commandgit push heroku maingit push dokku main
BuildpacksHeroku buildpacksSame Heroku buildpacks
Procfile supportYesYes
PluginsAdd-ons marketplacePlugin system (databases, Let’s Encrypt, etc.)
Web UIYesNone (CLI only)
Multi-serverYesSingle server only
Resource usageN/A~100 MB for Dokku itself
LicenseProprietaryMIT

Best for: Solo developers or small teams comfortable with the command line. The most Heroku-compatible alternative.

CapRover — Best for Docker-First Workflows

CapRover is a Docker-based PaaS with a web dashboard. It’s less opinionated than Coolify or Dokku — you deploy Docker images or Compose files rather than relying on buildpacks. CapRover has a one-click app marketplace with 100+ pre-configured applications.

Best for: Users who prefer Docker-native deployments over buildpack-based workflows.

Migration Guide

From Heroku to Dokku

  1. Provision a VPS ($5-15/month, Ubuntu 22.04+)
  2. Install Dokku:
    wget -nv -O - https://get.dokku.com | sudo bash
  3. Add your SSH key:
    echo "your-public-key" | sudo dokku ssh-keys:add admin
  4. Create the app:
    sudo dokku apps:create myapp
  5. Add PostgreSQL (if needed):
    sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
    sudo dokku postgres:create myapp-db
    sudo dokku postgres:link myapp-db myapp
  6. Set environment variables:
    sudo dokku config:set myapp KEY=value
  7. Add the Dokku remote and push:
    git remote add dokku dokku@your-server:myapp
    git push dokku main

Your Procfile, buildpack, and environment variables work unchanged from Heroku.

From Heroku to Coolify

  1. Install Coolify on your VPS:
    curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
  2. Access the dashboard at http://your-server:8000
  3. Connect your Git provider (GitHub, GitLab, or Bitbucket)
  4. Create a new resource → select your repository
  5. Configure environment variables through the dashboard
  6. Deploy — Coolify detects the framework and builds automatically
  7. Set up a custom domain and Coolify provisions SSL automatically

Cost Comparison

Heroku (3 apps + DB)Self-Hosted Dokku
Monthly cost$20-35/month$5-15/month (VPS)
Annual cost$240-420/year$60-180/year
3-year cost$720-1,260$180-540
Apps3 (paid per dyno)Unlimited (VPS resources)
Database10K rows ($5/mo)Unlimited (your disk)
SSLIncludedIncluded (Let’s Encrypt)
Dyno sleepingYes (Basic)No

What You Give Up

  • Managed infrastructure. Heroku handles OS updates, security patches, and scaling. Self-hosted means you manage the server.
  • Add-on marketplace. Heroku has hundreds of add-ons (logging, monitoring, email, search). Self-hosted PaaS tools have plugin systems, but the ecosystem is smaller.
  • Horizontal scaling. Heroku scales dynos with a slider. Self-hosted scaling means provisioning more servers and load balancing.
  • Review apps. Heroku creates temporary app instances for PRs. Coolify supports preview deployments; Dokku does not natively.
  • Dashboard polish. Heroku’s dashboard is mature. Coolify’s is good and improving. Dokku has no dashboard.
  • Support SLA. Heroku offers enterprise support contracts. Self-hosted means community support.

FAQ

Can I deploy my existing Heroku app to Dokku without changing any code?

In most cases, yes. Dokku uses the same buildpacks as Heroku, so apps with a Procfile and standard language detection deploy with git push dokku main — the same workflow you already know. Environment variables need to be re-set with dokku config:set, and if you use Heroku-specific add-ons (like Heroku Redis or Heroku Postgres), you’ll install the equivalent Dokku plugins instead. The application code itself typically requires zero modifications.

How do I handle databases when migrating from Heroku?

Both Dokku and Coolify provision databases directly on your server. For Dokku, install the postgres plugin (dokku plugin:install dokku-postgres) and link it to your app — it automatically sets DATABASE_URL. To migrate data, use pg_dump on Heroku’s database and pg_restore on your new instance. Coolify creates databases through its dashboard with one click. In both cases, your database runs alongside your app on the same VPS with no row limits or per-database charges.

Will my app sleep after inactivity like Heroku’s free/basic tier?

No. Self-hosted PaaS tools keep your apps running continuously. There’s no dyno sleeping, no cold start delays, and no 30-minute inactivity timeout. Your app responds instantly to every request, 24/7. The only constraint is your VPS resources — a $5/month VPS with 2 GB RAM comfortably runs 3-5 small web apps without any sleep behavior.

Can Coolify or Dokku handle SSL certificates automatically?

Yes. Dokku uses the Let’s Encrypt plugin — run dokku letsencrypt:enable myapp and it provisions and auto-renews certificates. Coolify handles SSL automatically through its built-in Traefik reverse proxy — point your domain, and Coolify provisions Let’s Encrypt certificates without manual configuration. Both match Heroku’s automatic SSL experience.

How do I set up CI/CD for automatic deployments?

Dokku supports git push deploys natively — add a webhook to your GitHub/GitLab repository or use a CI pipeline that pushes to your Dokku remote on merge. Coolify connects directly to GitHub, GitLab, or Bitbucket and deploys automatically on push to a configured branch, with optional preview deployments for pull requests. Both approaches replicate Heroku’s git push deploy workflow.

Can I run multiple apps on the same server?

Yes — this is where self-hosted PaaS saves the most money compared to Heroku. Dokku and Coolify both route traffic to the correct app based on domain name. A single $10/month VPS with 4 GB RAM can run 5-10 small web apps, each on its own domain, with shared databases. On Heroku, the same setup costs $35-70/month in dyno fees alone, plus database add-ons.

What happens if my server goes down — is there built-in redundancy?

Self-hosted PaaS tools on a single VPS have no built-in redundancy — if the server goes down, your apps go down. This is the main trade-off versus Heroku’s managed infrastructure. Mitigations: choose a provider with strong uptime (Hetzner, DigitalOcean offer 99.9%+ SLAs), set up automated backups with Restic or BorgBackup, and use Uptime Kuma for monitoring. Coolify supports multi-server setups for redundancy, but this requires additional VPS instances.

Comments