Architecting Applications for Heroku
Last updated 24 March 2014
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 a common set of 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.
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.
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.
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.|