The Twelve-Factor app is a methodology for apps that use declarative formats, have a clean contract, are suitable for modern cloud platforms, minimize divergence, and can scale up without significant changes. According to IBM’s Daniel Berg, the 12 factors are directly related to the same principles for developing apps with the microservices architecture.

The Twelve-Factor app was published by Heroku co-founder Adam Wiggins in 2011 based on the development, operation and scaling witnessed on the Heroku platform. “Twelve Factor apps are built for agility and rapid deployment, enabling continuous delivery and reducing the time and cost for new developers to join a project. At the same time, they are architected to exploit the principles of modern cloud platforms while permitting maximum portability between them. Finally, they can scale up without significant changes to tooling, architecture or development practices,” the Heroku team wrote in a post.

Recently, with the rise of microservices, the 12 factors have started to become more popular because it aligns with the microservices principle, according to Pivotal’s Lawrence Crowther.

The 12 factors are “a triangulation on ideal practices for app development, paying particular attention to the dynamics of the organic growth of an app over time, the dynamics of collaboration between developers working on the app’s codebase, and avoiding the cost of software erosion,” the methodology states.

According to its website, the 12 factors are:

  1. One codebase tracked in revision control, many deploys
  2. Explicitly declare and isolate dependencies
  3. Store config in the environment
  4. Treat backing services as attached resources
  5. Strictly separate build and run stages
  6. Execute the app as one or more stateless processes
  7. Export services via port binding
  8. Scale out via the process model
  9. Maximize robustness with fast startup and graceful shutdown
  10. Keep development, staging and production as similar as possible
  11. Treat logs as event streams
  12. Run admin/management asks as one-off processes

Crowther suggests those starting on a microservices journey from scratch should strictly follow the 12 factors if they wish to gain agility and the ability to scale. However, if they are taking a legacy monolithic application and transitioning it to a microservice, it will be harder to adhere to those 12 factors. Over time, companies can start introducing or improving the codebase more in line with the 12 factors, Crowther explained.

“The 12 factor apps check-list is really just a set of guidelines that dictate how a microservice should be built to properly support the concept of independently managed and iterated services. These factors are important when building decoupled, stateless microservices,” said Matt Ellis,  product management and strategy architect at TIBCO.