The Wild

Heroku Alternatives: How to Choose & Migrate Safely

· 8 min read · Mammals

In this article
  1. Why People Leave Heroku
  2. What to Look For in a Heroku Alternative
  3. Main Categories of Heroku Alternatives
  4. How to Choose the Right One for Your App
  5. Step-by-Step Migration Process
  6. Common Pitfalls and How to Avoid Them
  7. Cost Comparison and Pricing Models
  8. Frequently Asked Questions

To choose a Heroku alternative, first list your app’s runtime, database, and scaling needs, then compare platforms on lock-in, pricing model, and compliance; to migrate safely, replicate your production environment, export data and config, update DNS and environment variables, and run a phased cutover with rollback plans. Below is a practical guide covering the main options and the exact steps to move without downtime.

Why People Leave Heroku

Heroku pioneered the “PaaS” (Platform-as-a-Service) model—git push, and your app runs. It’s still a solid choice for small projects and prototypes. But as apps grow, several pain points push teams to migrate:

  • Cost: Heroku’s per-dyno pricing and add-on fees (databases, Redis, logging) can become expensive compared to a single VM or a modern container platform.
  • Scaling limits: Dynos are ephemeral and horizontally scaled by adding more units; some apps need finer control over CPU, memory, or auto-scaling rules.
  • Vendor lock-in: Heroku’s environment variables, buildpacks, and add-ons are proprietary. Moving to a standard container or Kubernetes setup requires rework.
  • Sleeping dynos: Free and hobby dynos sleep after 30 minutes of inactivity, causing cold-start delays.
  • Regional availability: Heroku offers fewer regions than hyperscale clouds (AWS, Google, Azure).

You might also simply want to consolidate cloud bills or need a feature Heroku doesn’t offer, like custom domains on free tiers or specific compliance certifications.

What to Look For in a Heroku Alternative

Before comparing vendors, define your non-negotiables. The right choice depends on your team’s skill set and your app’s architecture. Key factors to evaluate:

  • Runtime compatibility: Does it support your language (Node, Python, Ruby, Go, Java, PHP) and the version you use? Some platforms are language-agnostic (containers), others are buildpack-based like Heroku.
  • Database and add-ons: Do you need a managed Postgres, MySQL, Redis, or object storage? Check if the platform offers them natively or if you must connect to an external service.
  • Deployment workflow: Do you want git-push deploys, Docker builds, or CI/CD integration? Teams already using GitHub Actions may prefer a platform that plugs in cleanly.
  • Scaling model: Can you scale horizontally (more instances) and vertically (bigger instances)? Is auto-scaling available?
  • Pricing structure: Is it per-instance, per-container, or based on resource usage? Watch out for egress fees and hidden costs for data transfer.
  • Compliance and security: If you handle healthcare (HIPAA), finance (PCI), or EU user data (GDPR), verify the platform’s certifications and data residency options.
  • Support and community: A smaller platform may have fewer tutorials and slower support. Check the documentation and community forums.

Make a shortlist of three platforms that meet your must-haves, then run a proof-of-concept with one of your simpler services.

Main Categories of Heroku Alternatives

Alternatives fall into three broad buckets, each with trade-offs:

  • Other PaaS providers: Platforms like Railway, Render, Fly.io, and Northflank offer a similar “push to deploy” experience but with modern twists (container support, global regions, simpler pricing). They are the closest drop-in replacements.
  • Cloud platforms with PaaS layers: AWS Elastic Beanstalk, Google App Engine, and Azure App Service provide managed runtimes on top of IaaS. They are more powerful but have steeper learning curves and more complex configuration.
  • Container platforms and Kubernetes: If you want full control, you can run your app on AWS ECS, Google Cloud Run, or a managed Kubernetes service (EKS, GKE, AKS). This requires more operational work but eliminates vendor lock-in.

For most small-to-medium apps, a modern PaaS like Render or Fly.io is the sweet spot. For larger teams with DevOps expertise, moving to a container platform might be worth the effort.

How to Choose the Right One for Your App

Start by answering these questions:

  1. What is your app’s architecture? If it’s a monolith with a single web process and a database, any PaaS works. If it’s microservices with background workers, you need a platform that supports multiple process types.
  2. Do you use Heroku add-ons? List every add-on (Postgres, Redis, SendGrid, etc.) and find equivalent managed services on the target platform. If an add-on has no direct equivalent, you may need to run your own or switch to a different provider.
  3. What is your team’s skill level? A small team that just wants to deploy quickly should avoid Kubernetes. A team with DevOps engineers can handle more complexity.
  4. What is your budget? Estimate monthly costs for your current Heroku usage and compare with the alternative’s pricing calculator. Include data transfer and backup costs.
  5. Where are your users? If most users are in Europe, choose a platform with EU regions to reduce latency and comply with data residency rules.

For example, a Ruby on Rails app with a Postgres database and a Sidekiq worker would fit well on Render: it supports Ruby natively, offers managed Postgres and Redis, and lets you run separate web and worker services. A Node.js app that needs to scale to zero could use Google Cloud Run, which charges only when requests are processed.

Step-by-Step Migration Process

Migrating safely is about minimizing downtime and risk. Follow these steps:

  1. Inventory your Heroku app: List all dynos (web, worker, etc.), add-ons, environment variables, buildpacks, and custom domains. Save your Procfile and any app.json.
  2. Set up the target environment: Create your app on the new platform, configure environment variables, and provision equivalent databases and add-ons.
  3. Migrate your data: Use a tool like pg_dump and pg_restore for Postgres, or mongodump for MongoDB. For large databases, consider a logical replication or a one-time dump/restore during a maintenance window.
  4. Deploy your code: Push your code to the new platform. If you use Docker, build an image and deploy it. If you use buildpacks, ensure the platform supports the same stack.
  5. Test thoroughly: Run your test suite against the new environment. Verify that background jobs, cron tasks, and file uploads work.
  6. Switch DNS: Update your domain’s DNS records to point to the new platform. Lower the TTL before the cutover to speed up propagation.
  7. Monitor and rollback: Keep your Heroku app running during the transition. If issues arise, you can switch DNS back. After a few days of stability, decommission the Heroku app.

For zero-downtime migrations, use a blue-green strategy: deploy the new version alongside the old, run a database replication, and then flip traffic with a load balancer or DNS.

Common Pitfalls and How to Avoid Them

  • Ignoring environment variables: Heroku stores config in config vars. Export them with heroku config:get and re-create them on the new platform. Don’t hard-code secrets.
  • Assuming file system persistence: Heroku’s filesystem is ephemeral. If your app writes to local disk, you must switch to object storage (S3, GCS) or a persistent volume.
  • Forgetting background workers: If you have a worker dyno, ensure the new platform supports running separate processes. Some PaaS providers require you to define them in a config file.
  • Underestimating database migration time: Large databases can take hours to dump and restore. Plan a maintenance window and notify users.
  • Not testing third-party integrations: Webhooks, email services, and payment gateways may have IP allowlists or require callback URL updates.

A common misconception is that moving to a container platform automatically means using Kubernetes. Not true—AWS Fargate and Google Cloud Run let you run containers without managing servers.

Cost Comparison and Pricing Models

Heroku’s pricing is based on dyno hours and add-on usage. A basic hobby dyno costs about $7/month, but production dynos start at $25/month each. Add-ons like Postgres and Redis can double the cost. Alternatives vary:

  • Render: Charges per instance (web services start around $7/month for a small instance) plus bandwidth. Free tier available but sleeps after inactivity.
  • Fly.io: Uses a credit system based on VM size and duration. A small shared VM can cost around $2-3/month, but you pay for egress and storage.
  • Railway: Usage-based pricing—you pay for CPU, memory, and bandwidth. A small app might cost $5-10/month.
  • AWS Elastic Beanstalk: You pay for the underlying EC2 instances and RDS databases. Costs can be lower for steady workloads but require more configuration.

Always estimate your actual usage—not just the base price—including data transfer, storage, and backups. Some platforms charge for egress, which can surprise you if you serve large files.

Frequently Asked Questions

Can I migrate from Heroku without downtime?

Yes, if you use a blue-green deployment or DNS-based cutover. Keep the Heroku app running, replicate the database to the new platform, and switch traffic gradually. For most apps, a few minutes of downtime is acceptable if you schedule it during off-peak hours.

What is the easiest Heroku alternative for a small project?

Render is often the easiest because it supports git-push deploys, has a free tier for static sites and small services, and offers managed Postgres and Redis. Railway is also beginner-friendly with a simple CLI and dashboard.

Do I need to rewrite my app to move off Heroku?

Usually not. If your app uses standard buildpacks and environment variables, you can deploy it to most PaaS platforms with minimal changes. However, if you rely on Heroku-specific features like Heroku Connect or Heroku Scheduler, you’ll need to replace them with alternatives.

How do I migrate my Heroku Postgres database?

Use pg_dump to create a backup, then pg_restore on the new database. For zero-downtime, set up logical replication using a tool like pglogical or use Heroku’s follower database feature to promote a replica on the new platform.

What should I do with my Heroku add-ons?

Before migrating, list all add-ons and find equivalents. For example, Heroku Redis can be replaced with Redis Cloud or a managed Redis on the new platform. For add-ons like SendGrid, you can keep using the same external service—just update the API keys in your environment variables.

Is Kubernetes worth the complexity for a small app?

Probably not. Kubernetes gives you flexibility but requires significant operational expertise. For a small app, a managed container platform like Cloud Run or AWS Fargate gives you many of the benefits without the overhead.