What Is Twelve-Factor App?
The Twelve-Factor App Methodology
The Twelve-Factor App is a methodology for building modern, cloud-native applications that are portable, scalable, and maintainable. Created by Heroku co-founder Adam Wiggins, it defines 12 best practices covering everything from configuration to logging.
How Twelve-Factor App Works
Key factors: store config in environment variables (not code), treat backing services as attached resources, execute the app as stateless processes, and export services via port binding. These principles align perfectly with containers and cloud deployment.
Key Concepts
- Config in Environment — Store configuration (API keys, database URLs) in environment variables, never in code
- Stateless Processes — App processes should be stateless — store session data in Redis or a database, not in memory
Frequently Asked Questions
Are all 12 factors still relevant?
Most are, though some (like 'one codebase per app') are debated in the monorepo era. The principles of stateless processes, environment-based config, and treating services as disposable remain foundational for cloud-native development.