Published on

What is 12-factor app ?


Image description

Every DevOps engineer should know about 12-factor apps.

So what is 12-factor app?

The 12 Factor App methodology is a pattern to design scalable application architecture.

What is the advantage?

Twelve-factor design helps you decouple components of the app, so that each component can be replaced easily, or scaled up or down seamlessly.

Because the factors are independent of any programming language or software stack, twelve-factor design can be applied to a wide variety of apps.

Here is the summary of a 12 factor app.

  1. Codebase: One codebase tracked in revision control, many deploys. There is only one codebase per app, but there will be many deploys of the app.

  2. Dependencies: Always manage the app dependencies externally using dependency management configs & tools

  3. Config: The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy to change between deploys without changing any code.

  4. Backing services: A backing service is any service the app consumes over the network as part of its normal operation. Treat backing services as attached resources

  5. Build, release, run: Strictly separate build and run stages

  6. Processes: Execute the app as one or more stateless processes. Twelve-factor processes are stateless and share-nothing. Any data that needs to persist must be stored in a stateful backing service, typically a database.

  7. Port binding: Export services via port binding

  8. Concurrency: The principle of Concurrency recommends organizing processes according to their purpose and then separating those processes so that they can be scaled up and down according to need.

  9. Disposability: Maximize robustness with fast startup and graceful shutdown

  10. Dev/prod parity: Keep development, staging, and production as similar as possible

  11. Logs: Treat logs as event streams

  12. Admin processes: the twelve-factor methodology strongly suggests keeping such admin scripts together with the application codebase. For example, schema migration script or a DB backup script.

Hope this guide gives you an understanding of 12-factor app.

Let me know your thoughts in the comment section 👇 And if you haven't yet, make sure to follow me on below handles:

👋 connect with me on LinkedIn 🤓 connect with me on Twitter 🐱‍💻 follow me on github ✍️ Do Checkout my blogs

Like, share and follow me 🚀 for more content.