Twelve-Factor App Methodology Part II: The Codebase

Feri Lukmansyah
3 min readJul 31, 2022

--

Photo by Vidar Smits on Unsplash

A good application is an application that pays attention to version control such as git, subversion, and others, therefore it is necessary to have a good codebase, I won’t talk about a good codebase A or codebase B, but a codebase that includes various factors depending on the case, well let’s discuss one by one.

What is Codebase

A codebase is any single repo (in a centralized revision control system like Subversion), or any set of repos that share a root commit (in a decentralized revision control system like Git).

There is always a one-to-one correlation between the codebase and the app:

  • If there are multiple codebases, it’s not an app — it’s a distributed system. Each component in a distributed system is an app, and each can individually comply with twelve-factor.
  • Multiple apps sharing the same code are a violation of the twelve-factor. The solution here is to factor shared code into libraries which can be included through the dependency manager.

There is only one codebase per app, but there will be many deploys. A deployment is a running instance of the app. This is typically a production site, and one or more staging sites. Additionally, every developer has a copy of the app running in their local development environment, each of which qualifies as a deployment.

Based on Two Scoop of Django 3 to create a good project structure for Django applications, use the freezer concept (containerization).

source Two Scoop of Django 3
Two Scoop of 3 Project Structure

Based on the twelve-factor app methodology, this project structure is very good for developing monolithic or microservice applications with customization of course 😄

and what makes me like this concept is the implementation of the UNIX philosophy,
In Django, it is known as the golden rule of Django app design

The Golden Rule of Django App Design

James Bennett is a Django core developer. He taught us everything that we know about good Django app design. We quote him

“The art of creating and maintaining a good Django app is that it should follow the truncated Unix philosophy according to Douglas McIlroy: ‘Write programs that do one thing and do it well.”

that the point is that each application must focus on one task.

codebase concept

and adapt it to suit the twelve-factor app methodology regarding the codebase, where one codebase includes several server configurations in one codebase so that the applications created are easy to maintain and control using version control.

Conclusion

understanding in making the codebase is very important a fundamental in making applications because the wrong and inconsistent codebase will hinder the application development process.

--

--

Feri Lukmansyah
Feri Lukmansyah

Written by Feri Lukmansyah

A Software Engineer active on Upwork and Fiverr journal https://ferilukmansyah.dev

No responses yet