Skip to content
  1. Blog

Twelve-Factor WordPress App #1: Codebase

Scott Walkinshaw Scott Walkinshaw on

Factor #1: Codebase

One codebase tracked in revision control, many deploys

The first factor is a good one to start on because it’s probably the easiest. Your WordPress site/app codebase needs to be tracked in a version control system. Git, Mercurial, Subversion, etc. Pick one and use it. Git is usually the de facto choice these days and you can’t go wrong with it.

To make this clear and more WP specific:

1 WordPress site = 1 repo (1 codebase per app)

Deploys

A deploy is simply a running instance of the app. That means that you could have many servers in different environments (such as production, staging, development, etc.) all deployed to various revisions/commits/branches. It’s still one codebase and many deploys.

Repo Hosting

The easiest way to get started with VCS is to host the repository locally on your own computer. If you aren’t familiar with the command line, there’s a long list of great GUI programs that make it really easy.

You’ll also probably want to host your repo somewhere externally, especially if anyone else is contributing to it. GitHub and Bitbucket are the most popular and both offer private repositories as well. If you just want a place to host some private repositories without much collaboration, Bitbucket offers unlimited free private repos.

In Practice

Teaching you how to use Git or any other VCS is beyond the scope of this post/series. If you want to learn how to use it, there are countless resources available.

Elephant in the Room

Using version control is the first thing any software developer should do and yet it’s still common for WP developers to modify live production files over FTP. VCS isn’t new. GitHub didn’t invent it. RCS came out in 1982. Source Code Control System (SCCS) was created in 1972. Basically, version control is an old and solved problem. But it’s only solved if you actually use it.

I’m not sure what I could say to convince you to start using Git (for example) if you don’t already, but I’ll give it a shot:

Using version control is the single best thing you can implement for any software project. It will make things easier and eventually save your ass. It’s also the difference between professional and amateur developers. You shouldn’t be charging people if you aren’t using it.

Turning a WordPress site into a Twelve-Factor App

  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
  12. Admin processes

Want to turn your WordPress site into a Twelve-factor App? Bedrock is a modern WordPress stack to help you get started with the best tools and practices.

About the author

Scott Walkinshaw

Scott Walkinshaw is a full-stack web developer who's trying to drag WordPress into 2024 and help people modernize their development workflow. He lives in Toronto and likes sports almost as much as coding.

Subscribe for updates

Join over 8,000 subscribers on our newsletter to get the latest Roots updates and tips on building better WordPress sites

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?