Twelve-Factor App for WordPress

In this section, we will look at The Twelve-Factor App guide and its adaptation for use when developing WordPress projects.

1. Codebase – one code repository per application (Theme / Plugin).

Single Code - Single source of truth

This factor for WordPress adaptation:


Each site / theme / plugin — should live in its own repository.
Don’t make multiple sites with the same code and patches — fork them.

Example for really practice:
wp-content/themes/mytheme — one git repository
wp-content/plugins/myplugin — another

  1. Codebase – one code repository per application (Theme / Plugin).
  2. Dependencies – explicit declaration of dependencies.
  3. Config – configurations are stored in the environment.
  4. Backing services – services as resources (DB, cache, queues, etc.).
  5. Build, release, run – separate stages of build, release and launch.
  6. Processes – the application is launched as one or more processes.
  7. Port binding – independent HTTP service (not through Apache).
  8. Concurrency – scaling through processes.
  9. Disposability – fast start and correct termination of the process.
  10. Dev/prod parity – minimizing the difference between environments.
  11. Logs – streaming logging to stdout (do not store internally).
  12. Admin processes – one-time tasks as commands (console).