preloader

12 Factor Applications

Overview

In the modern era, software is commonly delivered as a service, often referred to as software-as-a-service.

The twelve-factor app is a methodology for building software-as-a-service applications that:

  • Use declarative formats for setup automation, to minimize time and cost for new developers joining the project.

  • Have a clean contract with the underlying operating system, offering maximum portability between execution environments.

  • Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration.

  • Minimize divergence between development and production, enabling continuous deployment for maximum agility.

  • Can scale up without significant changes to tooling, architecture, or development practices.

The twelve-factor methodology can be applied to applications written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc).

Background

The Heroku team created the 12 Factor App methodology to help teams build and deploy software-as-a-service applications.

Their motivation was to raise awareness of some systemic problems they saw in modern application development, to provide a shared vocabulary for discussing those problems, and to offer a set of broad conceptual solutions to those problems with accompanying terminology. The format is inspired by Martin Fowler’s books Patterns of Enterprise Application Architecture and Refactoring.

Applications deployed onto Kubernetes are often built using the 12 Factor App methodology following the same principles.

Who should read this document?

  • Any developer building applications which run as a service.
  • Ops engineers who deploy or manage such applications.
  • Platform Engineers managing Kubernetes environments.

The Twelve Factors

NumberDescriptionLink
1One codebase tracked in revision control, many deploysCodebase
2Explicitly declare and isolate dependenciesDependencies
3Store config in the environmentConfig
4Treat backing services as attached resourcesBacking services
5Strictly separate build and run stagesBuild,Release,Run
6Execute the app as one or more stateless processesProcesses
7Export services via port bindingPort binding
8Scale out via the process modelConcurrency
9Maximize robustness with fast startup and graceful shutdownDisposability
10Keep development, staging, and production as similar as possibleParity
11Treat logs as event streamsLogs
12Run admin/management tasks as one-off processesAdmin