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