Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 37 ยท Operations and Alternatives

Heroku Alternatives and Migration

Compare Heroku with other ways to host an app: PaaS rivals, container platforms, serverless, frontend hosts and self-hosting, and plan a portable app and a safe migration.

Heroku is one answer to the question "where do I run my app without managing servers?" It is not the only one. Prices, features and company strategies change, so a mature developer knows the landscape, keeps the app portable, and can move when it makes sense. This lesson compares the categories rather than selling any product; check each vendor's current pricing and documentation before deciding. Nothing here can be run on this site, so the runnable stand-ins are small decision and checklist scripts.

What you get from Heroku

Heroku's strengths are the thing you should look for elsewhere:

  • git push or a pipeline deploys; buildpacks detect your language.
  • Managed add-ons (Postgres, Redis, logging) are one command away.
  • Config vars, releases, rollback, review apps and pipelines are built in.
  • Operations work (patching the OS, load balancing, TLS) is Heroku's job.

The costs: dynos can be pricey at scale, the platform is opinionated (stateless processes, ephemeral disk, 30 second router timeout, no GPU or long-lived stateful servers), and you depend on one vendor.

Categories of alternatives

Category Examples Fits when
Other PaaS Render, Railway, DigitalOcean App Platform, Northflank, Platform.sh You like the Heroku workflow with different pricing or regions
Container platforms Fly.io, Google Cloud Run, AWS App Runner, Azure Container Apps You are happy to ship a Docker image; you want scale-to-zero or global regions
Serverless functions AWS Lambda, Cloudflare Workers, Vercel/Netlify functions Event-driven or spiky workloads, small units of code
Frontend/Jamstack hosts Vercel, Netlify, Cloudflare Pages Static or server-rendered frontends with global CDN
Cloud VMs or Kubernetes EC2, Droplets, Hetzner, GKE, EKS, AKS You need full control, special hardware or lower unit cost, and can operate it
Self-hosted PaaS Dokku, Coolify, CapRover You want Heroku-like pushes on your own server
Hyperscaler PaaS AWS Elastic Beanstalk, Azure App Service, Google App Engine You already live in that cloud

None is best in general. The right choice depends on team size, traffic shape, compliance, budget and skill.

flowchart LR
    A["Less control<br/>less operations"] --> B["Frontend hosts<br/>serverless"]
    B --> C["PaaS<br/>Heroku, Render"]
    C --> D["Container platforms"]
    D --> E["VMs and Kubernetes"]
    E --> F["More control<br/>more operations"]

Moving right gives more freedom and flexibility, and more work for you.

Questions that decide the choice

  1. Workload shape. Steady web app, bursty API, background jobs, long-lived websockets, batch or GPU work?
  2. Team. Does anybody want to be on call for servers? A small team pays for convenience.
  3. Data. Where is the database, and how much latency to the app can you accept? Moving a database is the hardest part of any migration.
  4. Cost at your size. Compare the full bill: compute, database, bandwidth, logs, support, your time.
  5. Compliance and region. Data residency and certifications may rule options out.
  6. Lock-in. Which parts of the app depend on vendor-specific features?
Python Stand-in: weighted decision matrix

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With these weights the PaaS wins, but change weights to favour cost and control and the ranking flips. The exercise is the value: write your weights down before you look at pricing pages.

Keep the app portable

The same habits that make an app good on Heroku make it easy to move:

  • Twelve-factor config. All settings from environment variables.
  • Stateless processes with state in the database, cache or object storage.
  • Standard services. Plain PostgreSQL and Redis with standard clients; avoid vendor-only extensions without a plan.
  • A Dockerfile that builds and runs the app. Heroku can run containers too (heroku stack:set container), so a Dockerfile keeps both doors open.
  • Infrastructure written down in scripts or Terraform, not only in dashboard clicks.
  • Separate the build from the deploy so the same artifact can run anywhere.

Migrating step by step

  1. Inventory. List the processes in the Procfile, add-ons, config vars, scheduled jobs, domains, certificates and external allow-lists (IP addresses partners trust).
  2. Stand up the target with a copy of the code, a new database and the config vars. Run the test suite there.
  3. Move the data. Take a backup (backups), restore it into the new database, then use a short maintenance window or logical replication to catch up with the changes made in between.
  4. Rehearse the full cutover with a copy of production data, and time it.
  5. Lower DNS TTLs a day before, so that the switch propagates fast.
  6. Cut over: maintenance mode on the old app, final data sync, switch DNS (custom domains), verify, maintenance off.
  7. Keep the old app (scaled to zero, database retained) for a week as a fallback, then delete it.
Python Stand-in: portability scorecard

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The script prints 3 of 6 and lists the missing items, which become your migration prework.

Staying is also valid

Moving costs engineering time, risk and a period of running two systems. If Heroku's bill is small compared with your team's salary, staying is usually the economical choice. Migrate when you have a concrete reason: a cost you can measure, a feature you need (private networking, GPUs, regions), or a compliance requirement.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which habit makes an app easiest to move between platforms?

    Environment-based config and stateless processes are portable across Heroku and its alternatives.
  2. 2. What is typically the hardest part of a migration?

    Data has to move consistently while the app is live, so plan the sync and cutover carefully.
  3. 3. Which category is Dokku or Coolify?

    They give Heroku-like git-push workflows on a server you control.
  4. 4. Why lower DNS TTLs before a cutover?

    A short TTL makes resolvers pick up the new records within minutes instead of hours.

Summary

  • Alternatives range from other PaaS and container platforms to serverless, VMs and self-hosting.
  • Decide by workload, team, data location, total cost, compliance and lock-in.
  • Twelve-factor design plus a Dockerfile keeps you portable.
  • Migrate with inventory, rehearsal, data sync, DNS preparation and a fallback; staying is a valid answer.

Next: Project: Flask API with Postgres