# klyp/hummingbird architecture

> Architecture diagram of the GitHub repository klyp/hummingbird, 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/klyp/hummingbird
- Repository: https://github.com/klyp/hummingbird

## Overview

##### Project type and purpose
- This is a WordPress‐based theme starter project, packaged and delivered via Composer (`composer create-project klyp/hummingbird`).
- Its primary purpose is to scaffold a WordPress installation plus the “Hummingbird” base theme, allowing you to build a child theme in `public_html/wp-content/themes/child-theme`.
- Key pieces: environment configuration (`.env`), pre‐install checks (`pre-install.php`), WordPress core under `public_html/`, and theme code.

##### File structure
- Top‐level:
- `.env-example` / `wp-config-env.php`: environment variable templates for database, ACF key, etc.
- `composer.json` / `composer.lock`: declares dependencies (Hummingbird theme repo, possibly WP-CLI or ACF).
- `pre-install.php`: script run before install to validate environment variables or permissions.
- `public_html/`: webroot containing WP core.
- Under `public_html/wp-content/themes/`:
- `index.php` (Hummingbird theme bootstrap)
- Instructions to create `child-theme/` directory.
- No custom plugins or microservices; it’s a monolithic PHP app (WordPress).

##### Extract architecture hints from the README
- Describes steps to clone, configure `.env`, run `composer install`, ensure ACF plugin key is set.
- Emphasizes creating a child theme under `public_html/wp-content/themes/child-theme`.
- No mention of external APIs, so assume direct DB access and PHP rendering.

##### Main components
- Developer machine / CI: runs Composer & pre-install script
- Web server (Apache/Nginx + PHP-FPM)
- public_html directory (WordPress core files)
- Themes folder:
- Hummingbird base theme (installed by Composer)
- Child theme (custom code)
- MySQL (or configured database): stores WP data (posts, settings, ACF fields)
- Environment config loader (`wp-config-env.php` reading `.env`)
- External service: Hummingbird Theme Repo (GitHub) for Composer fetch

##### Relationships & data flows
- Composer → GitHub: fetch base theme & dependencies
- Composer → local filesystem: writes `vendor/`, `public_html/wp-content/themes/hummingbird/`
- Browser → Web server: HTTP requests
- Web server → PHP runtime: routes through `public_html/index.php` (WP front controller)
- PHP → `.env` loader: reads DB creds & plugin keys
- PHP → MySQL: queries and writes data
- Theme engine: Hummingbird core templates + child-theme overrides ← PHP

##### Architectural patterns & principles
- Monolithic MVC-style: WordPress core acts as controller & model; theme templates are view layer
- Separation of concerns:
- Core vs. custom code (base theme vs. child theme)
- Configuration vs. code (`.env` + `wp-config-env.php`)
- Dependency management (Composer)

- Components clearly labeled
- Scripts/configs: `.env-example`, `wp-config-env.php`, `pre-install.php`
- Composer’s role as both installer and dependency manager

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Clients"
        BR["Browser"]:::user
    end

    subgraph "Developer / CI"
        DEV["Developer / CI\n(Composer, WP-CLI)"]:::infra
        PRE["pre-install.php"]:::config
        CJ["composer.json"]:::infra
        CL["composer.lock"]:::infra
        ENVEX[".env-example"]:::config
        README["README.md"]:::doc
        GITIGN[".gitignore"]:::doc
        STYLEEX["styles.css.example"]:::doc
    end

    subgraph "External Services"
        GITHUB["Hummingbird Theme Repo\n(GitHub)"]:::third
    end

    subgraph "Web Server / PHP Runtime"
        WS["Apache/Nginx + PHP-FPM"]:::infra
        ROOT["public_html/"]:::infra
        WS-->|"serves"|ROOT

        ROOT-->WP["WordPress Core"]:::third
        ROOT-->WC["wp-config-env.php"]:::config
        ROOT-->WCNT["public_html/wp-content/"]:::infra
        ROOT-->INDEX["index.php"]:::third

        WCNT-->THDIR["public_html/wp-content/themes/"]:::infra
        THDIR-->HB["Hummingbird Base Theme"]:::third
        THDIR-->CT["Child Theme"]:::custom
        THDIR-->INDEX
    end

    DB["MySQL Database"]:::infra

    %% Connections
    BR-->|"HTTP GET/POST"|WS
    DEV-->|"runs Composer install"|WS
    DEV-->|"runs pre-install checks"|PRE
    DEV-->CJ
    DEV-->CL
    DEV-->ENVEX
    DEV-->README
    DEV-->GITIGN
    DEV-->STYLEEX

    CJ-->|"defines deps"|WS
    CL-->|"locks deps"|WS

    GITHUB-->|"HTTPS fetch"|DEV
    GITHUB-->|"HTTPS fetch"|WS

    WC-->|"load env vars"|WP
    WS-->|"SQL over TCP"|DB

    %% Click Events
    click ENVEX "https://github.com/klyp/hummingbird/blob/master/.env-example"
    click WC "https://github.com/klyp/hummingbird/blob/master/wp-config-env.php"
    click PRE "https://github.com/klyp/hummingbird/blob/master/pre-install.php"
    click CJ "https://github.com/klyp/hummingbird/blob/master/composer.json"
    click CL "https://github.com/klyp/hummingbird/blob/master/composer.lock"
    click README "https://github.com/klyp/hummingbird/blob/master/README.md"
    click GITIGN "https://github.com/klyp/hummingbird/blob/master/.gitignore"
    click STYLEEX "https://github.com/klyp/hummingbird/blob/master/styles.css.example"
    click ROOT "https://github.com/klyp/hummingbird/tree/master/public_html/"
    click WCNT "https://github.com/klyp/hummingbird/tree/master/public_html/wp-content/"
    click THDIR "https://github.com/klyp/hummingbird/tree/master/public_html/wp-content/themes/"
    click INDEX "https://github.com/klyp/hummingbird/blob/master/public_html/wp-content/themes/index.php"

    %% Styles
    classDef third fill:#ADD8E6,stroke:#000
    classDef custom fill:#90EE90,stroke:#000
    classDef infra fill:#D3D3D3,stroke:#000
    classDef config fill:#FFA500,stroke:#000
    classDef doc fill:#F0E68C,stroke:#000
    classDef user fill:#FFB6C1,stroke:#000
```
