The Twelve-Factor App, Part 1: Codebase
Summary
This episode of Developer Tea introduces the Twelve-Factor App methodology, originally promoted by Heroku, which outlines twelve principles for building modern, scalable software-as-a-service applications. The host, Jonathan Cottrell, explains that the series will cover each factor individually, starting with the first factor: Codebase.
The episode begins by listing all twelve factors (Codebase, Dependencies, Config, Backing Services, Build-Release-Run, Processes, Port Binding, Concurrency, Disposability, Dev/Prod Parity, Logs, and Admin Processes) to provide context before diving deep into the first. The host emphasizes that understanding these concepts provides valuable vocabulary for developers, making them more employable and better equipped for technical conversations.
A significant portion of the episode is dedicated to explaining what a codebase is: the complete code for a single application, including third-party dependencies managed through package managers (like npm, Bundler, or Homebrew). The host clarifies that a codebase should not be shared across multiple applications; shared code should instead be packaged separately. The codebase is tracked in a version control system (like Git) and hosted on a platform like GitHub, forming a single source of truth.
The host also explains related concepts like version control, commits, merges, and deployments. Under the Twelve-Factor model, every instance where the code runs—a developer’s laptop, a staging server, or a production server—is considered a ‘deploy’ that pulls from the same singular codebase. This ensures consistency and traceability across all environments.
Recommendations
Services
- Hired.com — The episode’s sponsor. Presented as a platform where software engineers and designers can get multiple job offers with upfront salary and equity details from over 2,500 companies. A special link offers a doubled signing bonus.
Tools
- Daku — A tool mentioned for creating a ‘homegrown Heroku’ on DigitalOcean using Docker. It’s presented as an interesting option for those wanting to spin up a droplet and emulate Heroku’s deployment model.
- Git — Referenced as probably the most popular version control system. It’s used as the primary example for how teams track changes, commit code, and perform merges.
- Package Managers (npm, Bundler, Bower, Homebrew, apt-get) — Various tools listed as examples for managing third-party dependencies in a codebase. They are described as solutions for pulling in external code that your application depends on.
Websites
- 12factor.net — The official site summarizing the Twelve-Factor App methodology. The host reads from it and recommends it as the primary resource for understanding all twelve factors.
- GitHub — Mentioned as the most popular example of a version control hosting system where a codebase (or repository) lives. The host suggests checking out GitHub.com if unfamiliar.
Topic Timeline
- 00:00:00 — Introduction to the Twelve-Factor App methodology — Jonathan Cottrell welcomes listeners and introduces the topic: the Twelve-Factor App, a methodology created by Heroku for building modern software-as-a-service applications. He mentions that the episode will focus on the first factor, Codebase, and provides the resource 12factor.net. He also notes that while Heroku popularized it, the principles can be applied on other platforms like DigitalOcean.
- 00:02:03 — Listing all twelve factors of the methodology — The host reads all twelve factors from the 12factor.net site: 1. Codebase, 2. Dependencies, 3. Config, 4. Backing Services, 5. Build, Release, Run, 6. Processes, 7. Port Binding, 8. Concurrency, 9. Disposability, 10. Dev/Prod Parity, 11. Logs, and 12. Admin Processes. He states that the episode will cover only the first factor in depth but encourages listeners to explore the full list for context.
- 00:03:18 — Explaining version control systems and basic terminology — Jonathan provides foundational definitions for listeners who may be new to concepts like version control. He explains that version control systems (like Git) track changes to code, allow multiple people to collaborate, and manage contributions through commits. He describes the process of committing changes, pushing them to a remote endpoint, and other developers pulling and merging those changes into their own work.
- 00:08:30 — Defining a codebase and its relationship to applications — The core definition of a codebase is provided: it is the code for one specific application, including third-party dependencies pulled in via package managers (e.g., Rails gems, npm packages). The host emphasizes that a codebase cannot contain multiple applications and should not be shared across applications. Shared code should be extracted into separate packages managed via package management solutions.
- 00:10:46 — Clarifying codebase, dependencies, and package managers — The host further clarifies the composition of a codebase. It includes your application code and references to third-party dependencies (like those specified in a Gemfile or package.json), but typically not the actual third-party code itself. He lists examples of package managers (Bower, npm, Bundler, Homebrew, apt-get) that manage these dependencies. The codebase is hosted in a version control system like GitHub.
- 00:12:04 — Codebase, deploys, and the summary of the first factor — Jonathan explains that under the Twelve-Factor model, any running instance of the application—a developer’s local machine, a staging server, or a production server—is considered a ‘deploy.’ All deploys should read from the same singular codebase tracked in revision control. He summarizes the first factor: one codebase, tracked in revision control, with many deploys. This ensures everyone on the team has access and the application can be deployed consistently to infinite endpoints.
Episode Info
- Podcast: Developer Tea
- Author: Jonathan Cutrell
- Category: Technology Business Careers Society & Culture
- Published: 2015-08-17T07:00:00Z
- Duration: 00:14:44
References
- URL PocketCasts: https://podcast-api.pocketcasts.com/podcast/full/cbe9b6c0-7da4-0132-e6ef-5f4c86fd3263/0d06e297-1f25-4f0f-8ae5-10ff4d0d2c51
- Episode UUID: 0d06e297-1f25-4f0f-8ae5-10ff4d0d2c51
Podcast Info
- Name: Developer Tea
- Type: episodic
- Site: http://www.developertea.com
- UUID: cbe9b6c0-7da4-0132-e6ef-5f4c86fd3263
Transcript
[00:00:00] Hey everyone and welcome to Developer Tea. My name is Jonathan Cottrell and today we’re going to be talking about 12-factor apps.
[00:00:12] Specifically, we’re going to be talking about one aspect of the 12 factors. That’s, I guess, the first factor and that is code base.
[00:00:21] But before we get into that, I want to say that 12-factor applications, this is an idea that was promoted and created by Heroku.
[00:00:31] Heroku is not a sponsor of the show, but this idea is, you can find a summary of it on 12factor.net and Heroku has built a pretty large infrastructure around this idea.
[00:00:45] I guess another thing that needs to be mentioned is that the 12-factor application really fits.
[00:00:51] The deployment model that Heroku has available kind of out of the box.
[00:00:56] But, of course, you can implement this on any other deployment platform that you would like to use, including a sponsor of the show, DigitalOcean.
[00:01:06] DigitalOcean, there’s a lot of others that will allow you to deploy in this way.
[00:01:11] In fact, there’s even, I’ll put this in the show notes, but there’s a way of creating kind of your own Heroku on DigitalOcean.
[00:01:19] It’s called Daku and it’s through Daku.
[00:01:21] With Docker, the idea is to have a kind of a homegrown Heroku docker.
[00:01:26] And, of course, you wouldn’t have all the features that Heroku offers, but it certainly is an interesting proposition for those of you who would like to just spin up a droplet on DigitalOcean.
[00:01:38] So, check that out. It’ll be in the show notes.
[00:01:40] I’m going to read a little bit from 12factor.net just to give you guys a little bit of an introduction.
[00:01:45] 12-factor app, it says,
[00:01:47] In the modern era, software is commonly delivered as a service.
[00:01:51] It’s called web apps or software as a service.
[00:01:53] And then the site goes on to give a list of the 12-factor apps kind of methodology and why it thinks that it’s important to have these 12 factors.
[00:02:03] And I think these are good.
[00:02:05] And I’m going to go ahead and read you the 12 factors, but we’re only going to talk in depth today about number one.
[00:02:10] Number one is code base.
[00:02:12] Number two is dependencies.
[00:02:14] Number three is config, configuration, if you don’t know what that means.
[00:02:18] Number four is backing services.
[00:02:20] Number five,
[00:02:21] Number five is build, release, run.
[00:02:23] Number six is processes.
[00:02:25] Number seven is port binding.
[00:02:27] Number eight is concurrency.
[00:02:29] Number nine is disposability.
[00:02:31] Number 10 is development and production parity.
[00:02:35] Number 11 is logs.
[00:02:38] And number 12 is admin processes.
[00:02:41] So, a lot of these are pretty specific.
[00:02:43] And we hopefully at some point we’ll be able to go over each and every one of them.
[00:02:47] Today we’re only going to cover number one in depth.
[00:02:50] And that’s code base.
[00:02:52] But these other ones, they really don’t mean a lot without you actually going and getting a little bit more context.
[00:02:58] So, go check it out at 12factor.net.
[00:03:01] Number one is code base.
[00:03:03] And that’s what we’re going to be talking about in depth today.
[00:03:06] One code base tracked in revision control with many deploys.
[00:03:11] Now, I want to go over some of this terminology that you’ll find on 12factor.net in case you aren’t familiar with it.
[00:03:18] And there are people who are listening to this show who perhaps have never been exposed to version control or the idea of deploying an application at all.
[00:03:28] So, I’d like to give you kind of a working definition of what these things actually mean.
[00:03:34] Version control systems, basically they track the changes that you make to your code.
[00:03:39] And they allow multiple people to work on the same code base.
[00:03:44] And we’ll talk about what a code base is in a second.
[00:03:46] But to basically work on the same code at different times.
[00:03:50] And then they all contribute to that version control system using typically what is called a commit.
[00:03:57] Now, a commit takes what you have done since you pulled down the latest things that other people have done.
[00:04:04] It will take what you have done and package it up into a commit.
[00:04:10] And there’s some data that goes along with that.
[00:04:12] And you push it to an endpoint.
[00:04:14] And then other things can happen.
[00:04:16] And that’s what happens with that code at that point.
[00:04:18] Perhaps your other team members will pull it down.
[00:04:20] And they’ll perform what’s called a merge.
[00:04:22] Which is where they take your code and they put it together with the code that they’ve been working on.
[00:04:28] And sometimes there are errors there and you have to manually fix those.
[00:04:32] But usually, good version control systems, for example, perhaps the most popular one right now is Git.
[00:04:39] Git will try to merge things on its own.
[00:04:42] Okay.
[00:04:43] So, we’re going to take a breather here.
[00:04:45] And talk about something totally different from version control.
[00:04:49] And that is jobs.
[00:04:51] If you want to get paid writing clean code and, you know, respecting the practices of the 12-factor app.
[00:04:59] And actually pushing things to version control.
[00:05:02] If you actually want a job in this industry, then Hired.com can help.
[00:05:08] Hired is today’s sponsor.
[00:05:10] On Hired, software engineers and designers are able to get over five job offers.
[00:05:14] In a single week.
[00:05:17] And each of these offers has salary and equity up front.
[00:05:21] And they have both full-time and contract opportunities from over 2,500 different companies.
[00:05:27] From 12 major tech hubs around the world.
[00:05:30] On top of that, it’s free to sign up.
[00:05:32] You never have any obligations.
[00:05:34] And they offer signing bonuses if you actually get a job.
[00:05:38] Now, usually that bonus is $2,000.
[00:05:41] But if you use the link.
[00:05:43] That I’m going to give you.
[00:05:45] From today’s show notes.
[00:05:47] Then you will actually double that bonus to $4,000.
[00:05:50] Check it out.
[00:05:51] It’s Hired.com slash developer T.
[00:05:54] Now, even if you aren’t looking for a job.
[00:05:56] But you know someone who is.
[00:05:58] You can refer them to Hired.
[00:06:00] And on top of the fact that they will get a bonus.
[00:06:02] And they’ll thank you for helping them find a job.
[00:06:05] You will also get a referral bonus.
[00:06:07] That’s a $1,337 bonus.
[00:06:11] Just for helping someone else.
[00:06:12] Find a job.
[00:06:14] And here’s a little pro tip.
[00:06:16] You may want to share the link from the show notes with them.
[00:06:18] Because it will give them that free double bonus.
[00:06:21] If they do end up getting the job.
[00:06:23] Once again, that link is Hired.com slash developer T.
[00:06:27] Now, speaking of jobs.
[00:06:29] The really awesome thing about listening to this show.
[00:06:33] And learning about things as simple as code deployment.
[00:06:37] And learning all of this vocabulary.
[00:06:39] All of this stuff.
[00:06:40] Is going to make it much easier for you to pursue this as a career.
[00:06:46] You’re going to get some information on this show.
[00:06:49] That will help you become more employable.
[00:06:51] If you don’t already know this information.
[00:06:53] And why is that?
[00:06:54] Well, it’s very simply because being familiar.
[00:06:57] Even with just the vocabulary.
[00:06:59] Understanding what something means.
[00:07:02] That puts you just a little bit ahead of the next guy.
[00:07:06] If you understand the difference between React.
[00:07:08] And reactive programming.
[00:07:10] For example.
[00:07:11] Go back and listen to the episode with Ben Lesh and I.
[00:07:15] Ben Lesh works at Netflix.
[00:07:17] If you understand the difference between those.
[00:07:19] Then when you’re having a conversation with a potential employer.
[00:07:23] About the two things.
[00:07:24] And you know the distinction between the two.
[00:07:27] That employer knows that you care about your craft.
[00:07:30] And that you’ve invested the time.
[00:07:33] To learn the differences.
[00:07:35] And to learn the nuances.
[00:07:37] Of computer science.
[00:07:39] And to learn the nuances of development.
[00:07:42] And that’s exactly why I make this show.
[00:07:44] Because even if you don’t immediately start using each and every one.
[00:07:48] Of the different 12 factors in your applications.
[00:07:52] You now have this vocabulary.
[00:07:54] You now can have a conversation about these things.
[00:07:57] And when that conversation occurs.
[00:07:59] You’re ready.
[00:08:00] You have some context.
[00:08:01] For what each of these things means.
[00:08:04] Because the truth is.
[00:08:05] You never know exactly.
[00:08:06] When those key pivotal moments.
[00:08:08] And key conversations are going to occur.
[00:08:11] It could be that your mentor is walking into the same coffee shop as you.
[00:08:16] Or a future employer is sitting at the same table as you are.
[00:08:20] At a given meet up.
[00:08:21] Who knows when these conversations are going to happen.
[00:08:24] But you know that you will have the necessary vocabulary.
[00:08:28] When they do.
[00:08:30] So now let’s talk about what a code base is.
[00:08:33] A code base.
[00:08:34] Is one specific applications code.
[00:08:38] And that’s all it is.
[00:08:41] A code base cannot contain multiple applications.
[00:08:45] And a code base cannot be shared.
[00:08:48] On multiple applications.
[00:08:50] The sharing of code should instead be done.
[00:08:53] Through a package management solution.
[00:08:56] Now these are all once again more terms.
[00:08:59] That you will need defined for you.
[00:09:01] But essentially.
[00:09:02] There are different types of solutions.
[00:09:04] That you can use.
[00:09:05] To create a code base.
[00:09:06] For example.
[00:09:07] You can create an application.
[00:09:08] That takes a bunch of other software.
[00:09:11] Perhaps third party package software.
[00:09:13] That you are using for your application.
[00:09:16] An example of this would be Rails.
[00:09:18] Or if you are only working as a front end developer.
[00:09:21] JQuery.
[00:09:22] And perhaps there are.
[00:09:24] You know if you are an iOS developer.
[00:09:26] There are CocoaPods.
[00:09:27] That you are pulling into your project.
[00:09:29] And your application can use.
[00:09:31] All of these different things.
[00:09:33] And you can write your own application code.
[00:09:36] On top of that.
[00:09:37] That would be considered your code base.
[00:09:39] All of that together.
[00:09:41] Now if you wanted to include your entire application.
[00:09:45] In another application.
[00:09:47] Or if you have code in your application.
[00:09:50] That you want to include in another application.
[00:09:52] But you don’t want to include the whole thing.
[00:09:55] Then under the 12 factor methodology.
[00:09:58] You would want to package up the parts.
[00:10:00] That you want to share.
[00:10:01] But a code base.
[00:10:02] Is not intended to be shared.
[00:10:05] With other applications.
[00:10:07] So let’s clarify.
[00:10:08] That could have gotten a little bit convoluted.
[00:10:10] A code base is the code of an application.
[00:10:13] Including third party pieces of code.
[00:10:16] That might have been pulled through a package manager.
[00:10:19] An example of a package manager.
[00:10:21] Would be something like Bower.
[00:10:23] Or perhaps NPM.
[00:10:25] Another example would be Bundler.
[00:10:28] And there is operating system level.
[00:10:30] Package management solutions.
[00:10:32] Such as Homebrew.
[00:10:34] Or apt-get.
[00:10:35] All of these things are intended to help you manage.
[00:10:38] Pulling in what we call dependencies.
[00:10:41] Which is third party code.
[00:10:43] That you want to use in your application.
[00:10:46] Now typically your code base.
[00:10:48] Specifically the code that you keep in version control.
[00:10:51] Will not include the actual code.
[00:10:55] From those third party tools.
[00:10:57] But instead will include some sort of specification file.
[00:11:01] That explains that your code depends.
[00:11:04] On those other third party solutions.
[00:11:07] In Rails this is the gem file.
[00:11:10] With node projects.
[00:11:12] This would be the package.json file.
[00:11:14] Even something like a make file.
[00:11:16] Could have external dependencies.
[00:11:19] That are pulled in.
[00:11:21] And used to make or compile a given tool.
[00:11:24] On your system.
[00:11:26] Now typically when someone is talking about a code base.
[00:11:29] They are referring to wherever.
[00:11:32] That code is hosted.
[00:11:34] On a version control hosting system.
[00:11:36] An example of this is GitHub.
[00:11:38] This is once again.
[00:11:40] Probably the most popular example.
[00:11:42] So go check it out.
[00:11:44] GitHub.com if you are unfamiliar.
[00:11:46] But GitHub is the code base.
[00:11:48] That would be considered.
[00:11:50] Where your code base actually lives.
[00:11:52] And in fact.
[00:11:54] Each of the developers individual.
[00:11:56] Personal computers.
[00:11:58] Your actual MacBook.
[00:12:00] Or whatever it is that you are using.
[00:12:02] That is considered a deploy.
[00:12:04] Under the 12 factor system.
[00:12:06] So the idea.
[00:12:08] Is that you can pull to your computer.
[00:12:10] Just like you can push.
[00:12:12] To a production computer.
[00:12:14] Another term that you will hear used.
[00:12:16] For code base is repository.
[00:12:18] Now a repository.
[00:12:20] Is simply where the code goes.
[00:12:22] When you commit it.
[00:12:24] When somebody commits a piece of code.
[00:12:26] And they push it.
[00:12:27] To a remote repository.
[00:12:29] On GitHub.
[00:12:31] That means very simply.
[00:12:33] That they are pushing the changes.
[00:12:35] That they have made to the code base.
[00:12:37] So to sum up the first factor.
[00:12:39] In a 12 factor app.
[00:12:41] You should have a singular code base.
[00:12:43] One that is tracked.
[00:12:45] In revision control.
[00:12:47] And one that everyone has access to.
[00:12:49] On your team.
[00:12:51] And that you can actually deploy.
[00:12:53] To an infinite number of endpoints.
[00:12:55] Given developers computer.
[00:12:57] Or perhaps a staging server.
[00:12:59] Or even the actual live.
[00:13:01] Production server.
[00:13:03] Every endpoint.
[00:13:05] Should read from that singular code base.
[00:13:07] That is managed.
[00:13:09] With source control.
[00:13:11] Thank you so much.
[00:13:13] For listening to today’s episode.
[00:13:15] Of Developer Tea.
[00:13:17] I appreciate each and every moment.
[00:13:19] That you spend listening to this podcast.
[00:13:21] Of course if you want to.
[00:13:23] Automatically receive.
[00:13:25] Updates about Developer Tea.
[00:13:27] You can always just subscribe.
[00:13:29] To the show.
[00:13:31] In whatever podcasting application you use.
[00:13:33] That way you automatically get the show.
[00:13:35] Three times a week.
[00:13:37] Thanks again to today’s sponsor.
[00:13:39] Hired.com
[00:13:41] If you are a software engineer.
[00:13:43] Or a designer.
[00:13:45] Or you know someone who is.
[00:13:47] And you or they are looking for a job.
[00:13:49] Hired is such an awesome option.
[00:13:51] For the job search.
[00:13:53] There are all these offers.
[00:13:55] From 2500 different companies.
[00:13:57] In 12 major tech hub cities.
[00:13:59] And you can go through those offers.
[00:14:01] And decide which ones you like.
[00:14:03] And accept or deny them.
[00:14:05] Without ever even talking to the company.
[00:14:07] There is salary and equity.
[00:14:09] And there is full time and contract opportunities.
[00:14:11] The best part is that it is free.
[00:14:13] And you get a signing bonus.
[00:14:15] If you accept a job.
[00:14:17] Of $2000.
[00:14:19] But if you use the special code.
[00:14:21] Again in the show notes.
[00:14:23] Hired.com
[00:14:25] If you use that special code.
[00:14:27] That 4000.
[00:14:29] Go check it out.
[00:14:31] Hired.com
[00:14:33] Thank you again for listening to today’s episode.
[00:14:35] And until next time.
[00:14:37] Enjoy your tea.