Architecting Applications for Heroku
Last updated April 25, 2024
Table of Contents
The Twelve Factor app, written by Heroku co-founder Adam Wiggins, is a methodology for building software-as-a-service apps in modern deployment environments.
Heroku is an open platform. There are no proprietary hooks or dependencies required to deploy and run your application. However, there are common architectural and development practices that ensure an optimal experience. Many of these concepts have their origins in the Twelve Factor methodology and are detailed here in the context of building your app for Heroku.
Background
The principles of application development outlined here have been collected from the experience managing a wide variety of software-as-a-service apps in the wild. They are a triangulation of ideal practices in app development, paying particular attention to the dynamics of the organic growth of an app over time, the dynamics of collaboration between developers working on the app’s codebase, and avoiding the cost of software erosion.
The motivation in presenting them here is to raise awareness of common systemic problems, to provide a shared vocabulary for discussing those problems, and to offer a set of broad conceptual solutions to those problems with accompanying terminology.
On Heroku
Heroku is an embodiment of these application development principles and differs from traditional server-based hosting in the following ways:
- it is application, not infrastructure, focused
- is a dynamic and distributed runtime environment
- utilizes a process-based execution model
- enforces a strict separation of apps and their dependencies
On Heroku, these differences are manifested in a variety of practices, all of which result in a well-designed and resilient application and are not platform-specific.
To see the technical details of the stack that runs and manages your application, which will add to your understanding of building apps on Heroku, read How Heroku Works.
Principles
There are several core development principles that Heroku developers should be aware of, and comfortable with, when designing applications. They are grouped into broad categories that loosely correlate to the stages of application development, deployment and management.
Category | Approach on Heroku |
---|---|
Development and configuration | Strict separation of code and configuration, explicit dependency declaration, tight development iterations and parity between environments. |
Runtime | Applications are run as independent, lightweight, and stateless processes with quick startup and shutdown. |
Management and visibility | Execute auxiliary tasks in one-off processes and view application output via collated log-stream. |