The 12 Factor App
The 12 Factor App is a methodology for building modern, cloud-native applications that are scalable, portable, and maintainable. The 12 factors are a set of best practices that promote agility, flexibility, and reliability in application development, deployment, and operation.
The twelve factors are:
- Codebase - One codebase per application, version-controlled in a single repository.
- Dependencies - Explicitly declare and isolate dependencies.
- Configuration - Store configuration in the environment, not in code.
- Backing services - Treat backing services (e.g. databases, caches, message brokers) as attached resources.
- Build, release, run - Strictly separate build, release, and run stages.
- Processes - Execute the app as one or more stateless processes.
- Port binding - Export services via port binding.
- Concurrency - Scale out via the process model.
- Disposability - Maximize robustness with fast startup and graceful shutdown.
- Dev/prod parity - Keep development, staging, and production as similar as possible.
- Logs - Treat logs as event streams.
- Admin processes - Run admin/management tasks as one-off processes.
Adopting the 12 Factor App methodology can bring a number of benefits to application development and deployment, including:
- Better scalability and availability: 12 Factor Apps can be easily scaled horizontally, making them more resilient to traffic spikes and ensuring high availability.
- Improved portability: By keeping the application stateless and externalizing configuration and services, 12 Factor Apps can be easily deployed to different environments and platforms.
- Faster development and deployment cycles: By strictly separating build, release, and run stages, and by using automation tools, 12 Factor Apps can be developed and deployed more quickly and with fewer errors.
- Enhanced maintainability: By following best practices for code organization, dependency management, and process management, 12 Factor Apps are easier to maintain over time.
Overall, the 12 Factor App methodology provides a set of guidelines for building modern, cloud-native applications that are scalable, portable, and maintainable, and that can be easily deployed and operated in a variety of environments.