{"id":31698,"date":"2021-10-25T06:47:13","date_gmt":"2021-10-25T12:17:13","guid":{"rendered":"https:\/\/www.solutionanalysts.com\/?p=31698"},"modified":"2021-10-29T06:34:35","modified_gmt":"2021-10-29T12:04:35","slug":"twelve-factor-app-methodology","status":"publish","type":"post","link":"https:\/\/www.solutionanalysts.com\/blog\/twelve-factor-app-methodology\/","title":{"rendered":"Concise Guide to Twelve-Factor App Methodology"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Evolving technology has brought many changes in the ways of developing web and mobile apps. However, the fundamental guidelines or methodologies never get changed. One such example is the twelve-factor methodology.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It has been around us for over a decade now and is still relevant for <\/span><a href=\"https:\/\/www.solutionanalysts.com\/enterprise-mobility-solutions\/\"><b>building enterprise-level apps<\/b><\/a><span style=\"font-weight: 400;\">. In this article, we are going to discuss the twelve-factor app methodology and its importance in the development process.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Introduced around 2011, the Twelve-Factor App is a set of guidelines used to build SaaS (Software as a Service) for modern enterprises.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It is designed to support discipline in the software development domain while addressing architectural, operational, and deployment-related concerns effectively.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">12-factor app methodology is suitable for cloud-native applications and software of a similar nature with on-premise hosting.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here are all 12 factors of this proven methodology.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Top_12_Factors_of_App_Methodology_Explained\"><\/span><b>Top 12 Factors of App Methodology Explained<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">We will start with the first and foremost factor- codebase or base code.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-31703\" src=\"https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-scaled.webp\" alt=\"Factor-app-Methodology\" width=\"2560\" height=\"1281\" srcset=\"https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-scaled.webp 2560w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-768x384.webp 768w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-1536x768.webp 1536w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-2048x1025.webp 2048w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-800x400.webp 800w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Codebase_for_Uniformity\"><\/span><b style=\"letter-spacing: 0px;\">Codebase for Uniformity<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">A twelve-factor app needs the code to be stored in source control like Git and defines the one-to-many relationship between a codebase and deployment of the resultant instances of the app. It is quite typical to have different versions of the application that can be run in a different environment.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">These days, we know the advantages of source control. Storage of a source code and its history enables us to get rid of issues related to code loss. It also facilitates many operations like branching, reverting changes, merging, and the like. <\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Dependency_Isolation\"><\/span><b style=\"letter-spacing: 0px;\">Dependency Isolation<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">When dependencies are hidden or conflicting between apps, they remain difficult to handle. Here, the Twelve-Factor App recommends declaring dependencies with the help of the package manager of the relevant programming language.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It also recommends that developers can package dependencies with the application instead of relying on system-wide tools.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If applications are run on the same host but need different dependencies, it is better to declare and isolate dependencies to avoid conflicts. <\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Configuration_Differences\"><\/span><b style=\"letter-spacing: 0px;\">Configuration Differences<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Even if the same code is deployed across different environments, every environment has a different configuration.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Twelve-Factor App recognizes this fact. Therefore, it is necessary to separate configuration from the code and store the same in environment variables. It means that only one application needs to be created that can be tested, deployed, and run in different environments.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Twelve-Factor App, however, does not say how to store secrets like passwords or API tokens.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Backing_Services\"><\/span><b style=\"letter-spacing: 0px;\">Backing Services<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Whether it is an SQL or NoSQL database, API, or SMTP service, it is essential to specify the external dependency accessed over a network in the app configuration. Also, an external dependency should be replaceable with a similar service when we change the configuration.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For example, we can take MySQL database, Memcached caching system, or Amazone S3 as a binary asset service.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now, if the app complies with the 12-Factor methodology then it makes no distinction between these services. Simply put, such an app treats all attached resources accessed using a URL or other credentials stored in configuration.\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/www.solutionanalysts.com\/blog\/benefit-of-cross-platform-app-development-for-fintech\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-31702\" src=\"https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-CTA-1-scaled.webp\" alt=\"Factor-app-Methodology-CTA-1\" width=\"2560\" height=\"303\" srcset=\"https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-CTA-1-scaled.webp 2560w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-CTA-1-768x91.webp 768w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-CTA-1-1536x182.webp 1536w, https:\/\/www.solutionanalysts.com\/blog\/wp-content\/uploads\/2021\/10\/Factor-app-Methodology-CTA-1-2048x243.webp 2048w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Build_Release_Run\"><\/span><b style=\"letter-spacing: 0px;\">Build, Release, Run<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">When it comes to running an application in a particular environment, three stages are involved-\u00a0<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Build Stage for using the code and dependencies to produce a build<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Release Stage for using the build and configuration to produce a release and\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Run Stage for running one or more instances of the release<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">The Twelve-Factor App rule separates these stages clearly to avoid any risk or code break. These days, many tools are available to do this separation and make the entire system easy.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Stateless_Processes\"><\/span><b> Stateless Processes<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">It is fair to mention that 12-Factor processes are stateless. Therefore, it is necessary to store the repetitive data in a stateful backing service.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A 12-Factor Application rule never expects that any cached material remains present in the future for new requests. It focuses on increasing the system\u2019s overall stability and scalability. <\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Port_Binding\"><\/span><b style=\"letter-spacing: 0px;\">Port Binding<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">This methodology acts as a standalone service and does not need runtime injection of a web server in an execution environment to make a web-facing service.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As a result, you can build a self-contained app that does not need any running or existing server for the execution. A web application built using the Twelve-Factor methodology exports HTTP as a service.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Councurrency_Scaling\"><\/span><b> Councurrency Scaling<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The 12-Factor principle is based on app scaling. App-based on this principle can run multiple instances at once. Stateless processes are easy to spin up and down as and when necessary based on metrics or a schedule. It can be spun up and down manually or automatically.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the other hand, apps with isolated dependencies can minimize the risk of issues when they run on different hosts. It makes the system ready to adapt more quickly as per the changing load.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Disposability_for_Minimizing_Downtime\"><\/span><b> Disposability for Minimizing Downtime<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The disposability principle focuses on maximizing the app\u2019s robustness with a fast startup. Even if the app gets destroyed it should be done smoothly and all utilized resources are cleaned up.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It is necessary to ensure that the shutting down of the app should not affect the users with its replacement with other apps.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apps made by using the disposability concept can also be up again if necessary. In a way, this concept is useful for minimizing the app\u2019s downtime. It ensures smooth exit and reentry of the application.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"DevelopmentProduction_Parity\"><\/span><b> Development\/Production Parity<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">This concept brings good discipline to the application development process while keeping different environments in sync. It includes the usage of the same type of backing software, frequent deployment to minimize the gap between the code, and giving the responsibility of deploying and monitoring apps to developers.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Though the Twelve-Factor Methodology suggests that developers should take the entire operational responsibility, it is not necessary for reality. But, it is fair to mention that this concept can minimize the gap related to time, programmers, and tools.\u00a0\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Logs_as_Events\"><\/span><b> Logs as Events<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">This rule indicates developers treat logs as event streams. Logging enables developers to keep a check on the app\u2019s behavior, but then, the 12-Factor methodology-based apps should not be concerned with log management.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Instead, it should treat log entries as event streams that can be routed to a separate service for analysis. Developers can write the app logs as standard outputs but its execution environment can take care of storage, capture, and archival of logs.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This concept offers more flexibility and empowers the developer to introspect the app\u2019s behavior over the period.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Admin_Processes\"><\/span><b> Admin Processes<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Though it is not directly related to developing services, it takes app management into consideration. It indicates that apps should run management or admin tasks in an identical environment as a regular and ongoing process. It also suggests using a built-in tool for the execution environment to run those scripts on the production server.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Concluding_Lines\"><\/span><b>Concluding Lines<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In its decade-long journey, the 12-factor app methodology has remained useful for software teams. It is instrumental in building enterprise-grade applications with a certain level of scale and reliability. When it comes to following acceptance criteria to make software production-ready, these guidelines remain highly beneficial.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Solution Analysts is a renowned web and <\/span><a href=\"https:\/\/www.solutionanalysts.com\/mobile-app-development\/\"><span style=\"font-weight: 400;\">mobile app development services<\/span><\/a><span style=\"font-weight: 400;\"> provider. Our in-house team of developers combines proven methodology and cutting-edge tools to build advanced app solutions. Do you want to know more about our range of services? Simply drop us a line at <\/span><a href=\"mailto:info@solutionanalysts.com\"><span style=\"font-weight: 400;\">info@solutionanalysts.com<\/span><\/a><span style=\"font-weight: 400;\"> and one of our expert business consultants will get back to you soon.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Evolving technology has brought many changes in the ways of developing web and mobile apps<\/p>\n","protected":false},"author":1,"featured_media":31701,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108],"tags":[],"class_list":["post-31698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobile-app"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/posts\/31698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/comments?post=31698"}],"version-history":[{"count":9,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/posts\/31698\/revisions"}],"predecessor-version":[{"id":31710,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/posts\/31698\/revisions\/31710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/media\/31701"}],"wp:attachment":[{"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/media?parent=31698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/categories?post=31698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.solutionanalysts.com\/blog\/wp-json\/wp\/v2\/tags?post=31698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}