# wakeforestuniversity/wordpress-contractor-base architecture

> Architecture diagram of the GitHub repository wakeforestuniversity/wordpress-contractor-base, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wakeforestuniversity/wordpress-contractor-base
- Repository: https://github.com/wakeforestuniversity/wordpress-contractor-base

## Overview

##### Project type and purpose
- This is a WordPress codebase (theme or plugin) managed via Composer and meant to run inside a standard WP installation.
- It includes custom templates, integration tests, and provisioning scripts for a Vagrant-based dev environment (VVV).

##### Break down the file structure into logical components
- Top-level bootstrap & entrypoint:
- index.php – front controller for incoming HTTP requests
- bootstrap.php – early initialization (autoload Composer, set up paths)
- .htaccess – Apache rewrite rules for “pretty” permalinks
- Dependency management:
- composer.json – PHP dependencies and custom installer settings
- vendor/ (installed by Composer, not shown in tree)
- Templates & business logic:
- /templates – custom page‐ and email‐templates used by theme/plugin
- test-*.php – standalone scripts exercising fundraising/payment flows
- Environment provisioning:
- /provision/vvv-init.sh – Vagrant VVV setup script
- /provision/vvv-nginx-default.conf – Nginx site config
- wp-cli.yml – default WP-CLI settings for interacting with the site
- Miscellaneous metadata:
- .gitignore, VERSION, CHANGELOG.md, README*.md

##### README for additional clues
- Setup revolves around Composer + VVV for local dev.

##### Main components & interactions
a. Dev Environment Layer
- Host OS (macOS/Linux/Windows)
- Vagrant / VirtualBox or VVV container
- Nginx (provisioned via vvv-nginx-default.conf)
- PHP-FPM
- MySQL (provided by VVV)
- WP-CLI

b. Application Layer
- WordPress Core (hooks, plugin system, DB abstraction)
- Custom WFU Code
- index.php → hands off to WordPress loader
- bootstrap.php → autoloads Composer and core plugin classes
- /templates → custom templates invoked via WP filters/templates API
- Composer Packages (third-party libraries)

c. Testing Layer
- test-fundraising.php, test-payment.php, etc.
- These scripts invoke WordPress+WFU codepaths to simulate donation/payment flows

d. External Dependencies
- Packagist / Composer installer extender (for custom installers)
- Any payment or fundraising APIs (implied by payment tests)

##### Architectural patterns & principles
- Front-controller: index.php delegates to WordPress API
- Dependency injection/autoload via Composer (bootstrap.php)
- Infrastructure-as-code for local dev (VVV provisioning scripts)
- Clear separation of concerns: templates vs. core logic vs. tests

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Dev Environment Layer
    subgraph "Dev Environment Layer"
        HostOS["Host OS"]:::infra
        VVV["Vagrant/VVV"]:::infra
        VVV_INIT["provision/vvv-init.sh"]:::infra
        NGINX_CONF["provision/vvv-nginx-default.conf"]:::infra
        WPCLI["WP-CLI"]:::infra
        VVV --> VVV_INIT
        VVV --> NGINX_CONF
        HostOS -->|"runs on"| VVV
        VVV --> WPCLI
    end

    %% Web Server Layer
    subgraph "Web Server Layer"
        NGINX["Nginx"]:::infra
        PHPFPM["PHP-FPM"]:::infra
        HostOS -->|"HTTP request"| NGINX
        VVV -->|"runs"| NGINX
        VVV -->|"runs"| PHPFPM
        NGINX -->|"forward PHP"| PHPFPM
    end

    %% Application Layer
    subgraph "Application Layer"
        HTACCESS[".htaccess"]:::infra
        INDEX["index.php"]:::app
        BOOT["bootstrap.php"]:::app
        COMPOSER["composer.json"]:::app
        WPCORE["WordPress Core"]:::app
        CUSTOM["WFU Custom Code"]:::app
        TEMPLATES["templates/"]:::app
        PHPFPM -->|"exec"| INDEX
        INDEX -->|"delegates to"| WPCORE
        INDEX -->|"autoload via"| BOOT
        BOOT -->|"initializes"| CUSTOM
        WPCORE -->|"hooks into"| CUSTOM
        CUSTOM -->|"uses templates"| TEMPLATES
        WPCORE -->|"SQL query"| MYSQL
        CUSTOM -->|"SQL query"| MYSQL
        COMPOSER -->|"install deps"| PACK
    end

    %% Database
    subgraph "Database"
        MYSQL["MySQL"]:::infra
        VVV -->|"provides DB"| MYSQL
    end

    %% Testing Layer
    subgraph "Testing Layer"
        TF["test-fundraising.php"]:::test
        TP["test-payment.php"]:::test
        TPC["test-payment-complete.php"]:::test
        TPCONF["test-payment-confirmation.php"]:::test
        WC["wp-cli.yml"]:::infra
        TF -->|"invoke"| INDEX
        TP -->|"invoke"| INDEX
        TPC -->|"invoke"| INDEX
        TPCONF -->|"invoke"| INDEX
        TF -->|"via WP-CLI"| WPCLI
        TP -->|"via WP-CLI"| WPCLI
        TPC -->|"via WP-CLI"| WPCLI
        TPCONF -->|"via WP-CLI"| WPCLI
        WPCLI -->|"read"| WC
        TF -->|"simulate flow"| WPCORE
        TP -->|"simulate flow"| WPCORE
    end

    %% External Services
    subgraph "External Services"
        PACK["Packagist/Composer Registry"]:::external
        PAYAPI["Payment APIs"]:::external
        CUSTOM -->|"calls"| PAYAPI
        TF -->|"calls"| PAYAPI
    end

    %% Metadata
    subgraph "Metadata"
        VERSION["VERSION"]:::meta
        CHANGELOG["CHANGELOG.md"]:::meta
        README1["README.md"]:::meta
        README2["README2.md"]:::meta
    end

    %% Click Events
    click INDEX "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/index.php"
    click BOOT "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/bootstrap.php"
    click HTACCESS "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/.htaccess"
    click COMPOSER "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/composer.json"
    click VVV_INIT "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/provision/vvv-init.sh"
    click NGINX_CONF "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/provision/vvv-nginx-default.conf"
    click WC "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/wp-cli.yml"
    click TEMPLATES "https://github.com/wakeforestuniversity/wordpress-contractor-base/tree/master/templates/"
    click TF "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/test-fundraising.php"
    click TP "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/test-payment.php"
    click TPC "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/test-payment-complete.php"
    click TPCONF "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/test-payment-confirmation.php"
    click VERSION "https://github.com/wakeforestuniversity/wordpress-contractor-base/tree/master/VERSION"
    click CHANGELOG "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/CHANGELOG.md"
    click README1 "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/README.md"
    click README2 "https://github.com/wakeforestuniversity/wordpress-contractor-base/blob/master/README2.md"

    %% Styles
    classDef infra fill:#AED6F1,stroke:#21618C,color:#1B4F72
    classDef app fill:#A9DFBF,stroke:#196F3D,color:#145A32
    classDef external fill:#F5B7B1,stroke:#C0392B,color:#641E16
    classDef test fill:#F9E79F,stroke:#B7950B,color:#7D6608
    classDef meta fill:#D5D8DC,stroke:#566573,color:#2C3E50
```
