Heroku

On this page 7

Heroku is a cloud platform as a service (PaaS) that builds, runs and scales web applications from source code, so developers deploy an app without provisioning or administering servers. In hosting, Heroku is the classic example of application-centric hosting: the customer supplies code and configuration, and the platform handles operating systems, runtimes, routing and process management.

Founded in 2007 and owned by Salesforce since 2010, Heroku popularized the git push deployment model and the twelve-factor app methodology. It supports Node.js, Ruby, Python, Java, PHP, Go, Scala and Clojure through official buildpacks, and runs workloads on infrastructure provided by Amazon Web Services.

How Heroku builds and runs applications

Heroku turns source code into a running service through a build, release and run pipeline. A deployment starts when the developer pushes code to a Heroku git remote or connects a GitHub repository, after which a buildpack detects the language, installs dependencies and compiles the app into a compressed, ready-to-run package called a slug.

The slug is combined with config vars, which are environment variables holding credentials and settings, to form an immutable release. Heroku then starts the release on dynos, which are isolated Linux containers. A text file called the Procfile declares the process types, such as a web process that receives HTTP traffic and worker processes that handle background jobs.

The table below summarizes the core concepts a Heroku user works with every day.

ConceptWhat it isWhy it matters
DynoIsolated Linux container running one processUnit of compute, scaling and billing
BuildpackScript set that compiles code for a languageRemoves manual server setup
SlugCompiled, compressed app bundleStarts quickly on any dyno
ProcfileList of process types and commandsDefines web and worker roles
Config varsEnvironment variables per appKeeps secrets out of code
Add-onsManaged services attached to an appDatabases, caching, logging, email
Core Heroku concepts

Incoming requests pass through the Heroku router, which distributes HTTP traffic across all running web dynos. The router enforces a 30-second timeout for the initial response, so long-running tasks belong in worker dynos fed by a queue rather than in web requests.

Dyno types and scaling options

Heroku offers several dyno tiers that differ in memory, CPU share, isolation and features. Applications scale horizontally by adding dynos of the same type and vertically by moving to a larger type, both through the dashboard or a single command.

TierTypical useNotable traits
EcoHobby projects and prototypesSleeps after inactivity; shared hour pool
BasicSmall apps that must stay awakeNo sleeping; single dyno per process type
StandardProduction apps with moderate trafficHorizontal scaling and preboot
PerformanceHigh-traffic or memory-heavy appsDedicated compute; autoscaling for web
Private and ShieldRegulated or isolated workloadsPrivate Spaces network isolation; compliance controls
Main Heroku dyno tiers

Free dynos were discontinued in November 2022, ending a long period in which Heroku served as the default sandbox for students and side projects. Since then, the low-cost Eco and Basic tiers fill that role, and exact prices should be checked at the time of purchase because they change.

Heroku compared with other hosting models

Heroku sits between raw infrastructure and fully abstracted serverless platforms. It trades control for convenience: the team gives up operating system access and fine-grained network tuning, and in return avoids patching, provisioning and most deployment scripting.

OptionUnit of deploymentOperations burdenBest fit
HerokuLong-running app processesLowServer-rendered apps, APIs, workers
Vercel and NetlifyStatic assets and functionsVery lowFront-end frameworks and Jamstack sites
Virtual private serverWhole virtual machineHighCustom stacks needing full root access
Managed hostingServer administered by providerLow to mediumTraditional sites such as WordPress
Container orchestrationContainers on clustersHighLarge teams with platform engineers
Heroku versus neighboring hosting options

Compared with Vercel and Netlify, Heroku is better suited to persistent processes, such as background workers, WebSocket servers and scheduled jobs. Compared with providers such as DigitalOcean or Hetzner, Heroku usually costs more per unit of compute, which the team pays to avoid administration work.

When Heroku is the right choice

Heroku fits best when developer time is scarcer than compute budget. Small teams, startups validating a product and agencies maintaining many modest applications benefit most, because a deployment pipeline, a managed Heroku Postgres database and log access are available within minutes.

Useful workflow features include pipelines that promote the same slug from staging to production, review apps that create a temporary environment for each pull request, and a release phase that runs database migrations before new dynos receive traffic. These features encourage repeatable releases with fast rollbacks to any previous release.

The decision table below matches common situations with a recommendation.

SituationRecommendationReason
Early-stage product with a small teamUse HerokuFast setup, no server administration
Steady high traffic with tight marginsConsider infrastructure as a serviceCompute costs grow quickly at scale
Purely static front endUse static site hostingLower cost and global CDN delivery
Need for custom kernel or system packagesUse a virtual server or containersDynos restrict system-level changes
Strict data residency outside offered regionsEvaluate other providersRegion choice is limited
Choosing whether to host on Heroku

Limitations and common pitfalls on Heroku

The most frequent surprise for newcomers is the ephemeral filesystem. Files written to a dyno disappear when the dyno restarts, and dynos are restarted at least once a day in a process called dyno cycling, so uploads and generated files must go to external object storage.

  • Request timeouts at 30 seconds break slow report generation or large uploads handled inside web requests.
  • Memory quotas per dyno trigger errors and slowdowns when an app exceeds its allowance.
  • Cost growth at scale often prompts migration once traffic becomes large and predictable.
  • Vendor-specific conventions, such as add-on provisioning, require rework when moving elsewhere, although twelve-factor apps port relatively easily.
  • Limited regions constrain latency-sensitive or data-residency requirements.

Most of these limits are design constraints rather than defects. Applications built as stateless processes with external storage and queues run reliably on Heroku and remain portable to other platforms.

Understanding it simply

Running a website usually means renting a server, installing software and keeping it updated. Heroku takes that job away. A developer hands over the code, and Heroku packages it, starts it and keeps it running on the internet.

It is similar to renting a fully furnished, serviced apartment instead of buying a house and fixing the plumbing yourself. You pay more per month, but you spend your time on your own work, not on maintenance. When more visitors arrive, you simply add more running copies of the app.

Applied in practice

A three-person startup builds a booking API in Python with a background worker that sends confirmation emails. Instead of hiring an operations engineer, the team deploys to Heroku with a Procfile defining one web process and one worker, attaches Heroku Postgres and a key-value store as add-ons, and stores API keys in config vars.

Each pull request gets a review app for testing, and approved changes are promoted from staging to production through a pipeline. When a marketing campaign triples traffic, the team scales from two to six Standard web dynos in under a minute and scales back afterward. Customer photos go to external object storage because of the ephemeral filesystem. The team ships features weekly with no dedicated infrastructure staff.