100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
DevOps

12-Factor App

Methodology for building cloud-native SaaS apps

IntermediateConcept8.8K learners

The 12-Factor App is a methodology of twelve best practices for building software-as-a-service applications that are portable, scalable, and easy to deploy on modern cloud platforms.

Definition

The 12-Factor App is a methodology of twelve best practices for building software-as-a-service applications that are portable, scalable, and easy to deploy on modern cloud platforms.

Overview

The 12-Factor App methodology was published by developers at Heroku, drawing on their experience running thousands of applications on a platform-as-a-service, to codify patterns that made apps easy to deploy, scale, and maintain versus patterns that caused constant operational pain. It predates much of today's cloud-native tooling but remains foundational reading for anyone designing services meant to run on Kubernetes or similar platforms. The twelve factors cover the full application lifecycle: a single codebase tracked in version control (I. Codebase); explicitly declared dependencies rather than assumed system packages (II. Dependencies); configuration stored in environment variables, not in code (III. Config); backing services like databases treated as attached resources (IV. Backing Services); a strict separation of build, release, and run stages (V-VI); running the app as stateless processes (VI); exporting services via port binding (VII); scaling out via the process model (VIII); fast startup and graceful shutdown for disposability (IX); keeping development, staging, and production as similar as possible for environment parity (X); treating logs as event streams rather than files to manage (XI); and running admin tasks as one-off processes (XII). Many of these ideas map directly onto containers and Kubernetes: config in environment variables aligns with Kubernetes ConfigMaps and Secrets, disposability aligns with how Kubernetes replaces pods freely, and stateless processes align with horizontal pod autoscaling. The methodology's influence is visible throughout modern DevOps practice even where teams don't explicitly cite it, because it was one of the first attempts to articulate why certain application design choices make cloud deployment dramatically easier than others.

Key Concepts

  • Twelve principles for building portable, scalable SaaS applications
  • Originated from Heroku's experience running platform-as-a-service infrastructure
  • Covers codebase, dependencies, config, backing services, and more
  • Advocates for stateless processes and horizontal scale-out
  • Recommends configuration via environment variables, not hardcoded values
  • Treats logs as event streams rather than managed files
  • Strongly aligned with container and Kubernetes deployment patterns
  • Widely referenced foundation for modern cloud-native application design

Use Cases

Designing new microservices intended for containerized deployment
Auditing legacy applications before migrating them to Kubernetes
Establishing configuration and secrets management conventions
Guiding decisions about statelessness and horizontal scaling
Onboarding new engineers to cloud-native application design principles

Frequently Asked Questions