The Twelve Factors

The Twelve Factors

  • The Twelve-Factor App methodology is a methodology for building software-as-a-service applications. These best practices are designed to enable applications to be built with portability and resilience when deployed to the web.
  • However, it is best suited for services running on virtual machines in an in-house data center or a cloud environment where traditional server operation and maintenance are expected. It doesn't reflect the latest development in IaaS, PaaS, Containerization, Microservices and Serverless.

I. Codebase

II. Dependencies

III. Config

IV. Backing services

  • Treat backing services as attached resources. Any backing service should be able to be swapped out with alternative sharing the same interface without any code change.

V. Build, release, run

  • Through cloud IaaS, provisioning tool such as Terraform along with CI/CD service can manage the whole.
  • Cloud CI/CD offerings such as AWS CodeDeploy provide various deployment strategies.

VI. Processes

  • Ideally, a serverless service is desired to achieve the stateless effect.

VII. Port binding

  • Using embedded server instead of deliverable running inside a server runtime

VIII. Concurrency

  • The app should be designed in a way that it is able to scale out by creating more individual processes, instead of overly relying on threads and doing everything in the same process.

IX. Disposability

  • App’s processes are disposable, meaning they can be started or stopped on demand, able to handle unexpected, sudden terminations.
  • To achieve this on-demand flexibility, minimum start-up time and graceful shutdown are needed.

X. Dev/Prod parity

  • Dev and Prod environments should be as close as possible in terms of software engineering.
  • Deliverables for different environments should be built with the same pipeline.

XI. Logs

XII. Admin Processes

  • Provisioning or configuration tool can cover this use case.