---
title: "Migrate from Heroku to Miget"
description: "Move a Heroku app to Miget - keep your Procfile, reuse $PORT, and migrate Postgres and Redis with familiar tooling."
---
Miget maps cleanly onto the Heroku mental model: you deploy apps, attach managed addons, and set config as environment variables. The biggest win is that Heroku apps already bind to the `$PORT` env var - and Miget speaks the same language, so most apps deploy without a single code change.
Unlike Heroku's per-dyno, per-addon billing, Miget gives you a fixed-capacity plan. You deploy unlimited apps, databases, workers, and preview environments inside the compute you buy.
## What maps to Miget
| Heroku | Miget |
| --- | --- |
| Dyno | App |
| Add-on | Managed addon / service |
| Config var | Environment variable |
| Procfile | Procfile |
| Review App | PR preview |
| Heroku Postgres | Miget managed PostgreSQL |
| Heroku Redis | Miget Valkey |
Heroku spreads workloads across many separately billed dynos and addons. On Miget, everything runs inside your plan's fixed capacity, scheduled fairly across your apps. See the [fair scheduler](/overview/fair-scheduler) for how compute is shared.
## The $PORT compatibility win
Heroku assigns each dyno a port at runtime and expects your app to bind to `$PORT`. Miget sets an **immutable** `PORT=5000` and routes all public traffic to port 5000.
Because your Heroku app already reads `$PORT`, it will read Miget's `PORT` the same way and bind to 5000 automatically. No code change is required.
If your app hardcodes a port instead of reading `$PORT`, change it to bind to the `PORT` env var (which will be `5000` on Miget). See [ports](/networking/ports) for details.
## Migration steps
Miget's buildpacks support a `Procfile`, so your existing Heroku `web` process works as-is:
```procfile
web:
```
Miget auto-detects the language from marker files (`package.json`, `requirements.txt`, `Gemfile`, and so on), similar to Heroku buildpacks. If you'd rather control the build yourself, commit a `Dockerfile` and Miget will build from it instead.
Confirm your app binds to the `$PORT` / `PORT` env var rather than a hardcoded port.
Any other `Procfile` process (`worker: bundle exec sidekiq`, `clock: ...`) comes along too - Miget runs each as its own [worker process](/deployments/workers), sized and scaled on its own, the same way `web` and `formation` sizes already map from your Heroku dyno types.
Create your app on Miget, then deploy by pushing your Git repository:
```bash
git remote add miget https://git..miget.io//
git push miget
```
Prefer to deploy from GitHub? Connect the repo via the [GitHub integration](/deployments/github-integration) for automatic deploys and PR previews - the equivalent of Heroku Review Apps. See [Git push to builder](/deployments/git-push-to-builder) for the full push-based flow.
Attach a [managed PostgreSQL](/databases/postgresql) addon. Miget injects a `DATABASE_URL` (a `postgres://...` connection string) into your app automatically - just like Heroku Postgres.
Dump from Heroku and restore into Miget:
```bash
# Dump from Heroku
pg_dump "$HEROKU_DATABASE_URL" -Fc -f dump.pgdump
# Restore into Miget
pg_restore --no-owner --dbname="$MIGET_DATABASE_URL" dump.pgdump
```
For plain SQL dumps you can pipe into `psql "$MIGET_DATABASE_URL"` instead.
The dump-and-restore flow above requires a maintenance window. For a large or production database, follow [Migrate from Heroku PostgreSQL to Miget with zero downtime](https://miget.com/blog/migrate-heroku-postgresql-to-miget), which uses Bucardo trigger-based replication to migrate without taking your app offline.
Using Heroku Redis? Attach a [Valkey](/databases/valkey) addon - Miget injects a `REDIS_URL` your app can use in place of the Heroku-provided one.
Recreate your Heroku config vars as Miget environment variables. `DATABASE_URL` and `REDIS_URL` are injected automatically by their addons, so you only need to set your own app-specific values.
See [using secrets](/deployments/using-secrets) for how to add and manage environment variables.
Add your custom domain and let Miget provision TLS automatically. You'll add a TXT record to verify ownership, then point a CNAME or A record at Miget - certificates are issued via Let's Encrypt.
Follow [custom domains](/networking/custom-domains/overview) to complete the cutover.
Miget accepts an `app.json` only as optional configuration, and its schema is not guaranteed to be a full Heroku compatibility layer. Don't rely on `app.json` to reproduce your Heroku setup - use a `Procfile` (`web: `) to define your process, and set config through environment variables. `heroku-postgresql` and `heroku-redis` entries in `addons` are provisioned as Miget PostgreSQL and Valkey addons; see [app.json](/overview/app-json#addons) for the size each tier maps to. Dyno types in `formation` map to Miget sizes; see [Worker processes](/deployments/workers#sizing-from-appjson).
## Next steps
Deploy by pushing your repository to Miget.
Auto-deploy and PR previews, like Heroku Review Apps.
Attach a database with an injected DATABASE_URL.
A Redis-compatible store with an injected REDIS_URL.
Move your Heroku config vars over as secrets.
Add a domain with automatic Let's Encrypt TLS.
See how Miget stacks up against the other options.