# dumitrusf/zoo-arcadia architecture

> Architecture diagram of the GitHub repository dumitrusf/zoo-arcadia, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dumitrusf/zoo-arcadia
- Repository: https://github.com/dumitrusf/zoo-arcadia

## Overview

##### Main Components
- Web Server & PHP Runtime: Represent Apache configured to serve the project. Emphasize that it uses PHP (with its configuration files in php.ini) to run server-side scripts.
- Frontend/Public Interface: Show the “public” directory as the entry point for the browser. This includes pages like index.php, about.php, contact.php, and specialized dashboards (dash-admin.php, dash-employee.php, dash-vet.php).
- Backend/Business Logic: Represent the “includes” directory which contains the configuration (e.g., database.php) and shared functions (functions.php, pageTitle.php) along with template components (nav.php, footer.php). This is where most of the logic and view partials reside.
- Assets & Styling: Include the “src/assets” (fonts, images) and “src/scss” directories. These are built via Gulp (gulpfile.js, package.json, package-lock.json) into the production CSS under public/build/css.
- Database Layer: Mark both the relational database (MariaDB) – with SQL scripts available under the “database” folder for initializing tables, constraints, indexes, etc. – and the non-relational database (MongoDB) as backend data stores.
- Dependency Management: Note the use of Composer for PHP dependency management (composer.json, composer.lock) and Node.js (package.json, package-lock.json) for frontend packages.

##### Relationships and Interactions
- A client (browser) interacts with Apache serving files from the “public” folder.
- Public PHP files act as controllers which include and call functions from the “includes” (and possibly additional libraries in “vendor”) for business logic.
- The backend code actively queries or manipulates data stored in MariaDB (and potentially MongoDB) as guided by scripts in the “database” folder.
- The Gulp automation process takes SCSS files from “src/scss” and compiles them into production CSS, placed under “public/build/css”, making sure that the presentation layer is current.
- There’s clear separation between presentation (public and’s front-end assets) and business logic (PHP code from the includes).

##### Architectural Patterns/Design Principles
- Although not a strict MVC setup, there is an implicit separation of concerns – server-side logic (PHP scripts within includes) is separated from the presentation layer (PHP pages in public) and styling (SCSS).
- The project leverages modular configuration and templating, which can be illustrated by emphasizing the use of files like config/database.php and separate template partials for navigation and footer.
- Automated frontend build processes (using Node.js and Gulp) emphasize a modern development workflow.
- The overall design focuses on responsiveness (mobile-first approach) and maintainability through clear separation of frontend assets and backend logic.

##### Technologies and Frameworks
- PHP with Apache as the web server.
- MariaDB (relational) and MongoDB (non-relational) for data storage.
- Composer for PHP dependencies.
- Node.js, Gulp, SCSS, and Bootstrap for frontend build and styling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Browser"]:::client
    Apache["Apache Server with PHP"]:::serverSide

    Client -->|"HTTP request"| Apache

    subgraph "Public Interface"
        PI_index["index.php"]:::frontend
        PI_about["about.php"]:::frontend
        PI_contact["contact.php"]:::frontend
        PI_dashAdmin["dash-admin.php"]:::frontend
        PI_dashEmployee["dash-employee.php"]:::frontend
        PI_dashVet["dash-vet.php"]:::frontend
    end

    Apache -->|"serves"| PI_index

    subgraph "Backend Business Logic"
        BL_database["includes/config/database.php"]:::serverSide
        BL_functions["includes/functions.php"]:::serverSide
        BL_pageTitle["includes/pageTitle.php"]:::serverSide
        BL_nav["includes/templates/nav.php"]:::serverSide
        BL_footer["includes/templates/footer.php"]:::serverSide
    end

    PI_index -->|"calls"| BL_functions

    subgraph "Database Layer"
        DB_maria["MariaDB"]:::database
        DB_mongo["MongoDB"]:::database
        SQL_init["database/2025_01_19_init.sql"]:::database
        SQL_tables["database/2025_01_19_tables.sql"]:::database
    end

    BL_functions -->|"queries"| DB_maria
    BL_functions -->|"queries"| DB_mongo
    DB_maria -->|"init"| SQL_init
    DB_maria -->|"tables"| SQL_tables

    subgraph "Assets & Styling"
        SCSS_app["src/scss/app.scss"]:::assets
        SCSS_base["src/scss/base"]:::assets
        SCSS_layout["src/scss/layout"]:::assets
        Assets_fonts["src/assets/fonts"]:::assets
        Assets_images["src/assets/images"]:::assets
        Gulp["gulpfile.js"]:::assets
        Node_pkg_build["package.json (Build)"]:::assets
        Node_lock_build["package-lock.json (Build)"]:::assets
        CSS_output["public/build/css/app.css"]:::assets
    end

    SCSS_app -->|"sources"| Gulp
    SCSS_base --> Gulp
    SCSS_layout --> Gulp
    Gulp -->|"compiles to"| CSS_output
    CSS_output -->|"applied to"| PI_index
    Assets_fonts -->|"assets"| PI_index
    Assets_images -->|"assets"| PI_index

    subgraph "Dependency Management"
        Composer_json["composer.json"]:::dependencies
        Composer_lock["composer.lock"]:::dependencies
        Node_dep_pkg["package.json (Node)"]:::dependencies
        Node_dep_lock["package-lock.json (Node)"]:::dependencies
    end

    Composer_json -->|"provides"| BL_functions
    Node_dep_pkg -->|"supports"| Gulp

    classDef serverSide fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef frontend fill:#90EE90,stroke:#000,stroke-width:2px
    classDef database fill:#FFD700,stroke:#000,stroke-width:2px
    classDef assets fill:#DDA0DD,stroke:#000,stroke-width:2px
    classDef dependencies fill:#FFA07A,stroke:#000,stroke-width:2px
    classDef client fill:#FFE4B5,stroke:#000,stroke-width:2px

    click PI_index "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/index.php"
    click PI_about "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/about.php"
    click PI_contact "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/contact.php"
    click PI_dashAdmin "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/dash-admin.php"
    click PI_dashEmployee "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/dash-employee.php"
    click PI_dashVet "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/dash-vet.php"

    click BL_database "https://github.com/dumitrusf/zoo-arcadia/blob/main/includes/config/database.php"
    click BL_functions "https://github.com/dumitrusf/zoo-arcadia/blob/main/includes/functions.php"
    click BL_pageTitle "https://github.com/dumitrusf/zoo-arcadia/blob/main/includes/pageTitle.php"
    click BL_nav "https://github.com/dumitrusf/zoo-arcadia/blob/main/includes/templates/nav.php"
    click BL_footer "https://github.com/dumitrusf/zoo-arcadia/blob/main/includes/templates/footer.php"

    click SCSS_app "https://github.com/dumitrusf/zoo-arcadia/blob/main/src/scss/app.scss"
    click SCSS_base "https://github.com/dumitrusf/zoo-arcadia/tree/main/src/scss/base"
    click SCSS_layout "https://github.com/dumitrusf/zoo-arcadia/tree/main/src/scss/layout"
    click Assets_fonts "https://github.com/dumitrusf/zoo-arcadia/tree/main/src/assets/fonts"
    click Assets_images "https://github.com/dumitrusf/zoo-arcadia/tree/main/src/assets/images"
    click Gulp "https://github.com/dumitrusf/zoo-arcadia/blob/main/gulpfile.js"
    click Node_pkg_build "https://github.com/dumitrusf/zoo-arcadia/blob/main/package.json"
    click Node_lock_build "https://github.com/dumitrusf/zoo-arcadia/blob/main/package-lock.json"
    click CSS_output "https://github.com/dumitrusf/zoo-arcadia/blob/main/public/build/css/app.css"

    click SQL_init "https://github.com/dumitrusf/zoo-arcadia/blob/main/database/2025_01_19_init.sql"
    click SQL_tables "https://github.com/dumitrusf/zoo-arcadia/blob/main/database/2025_01_19_tables.sql"

    click Composer_json "https://github.com/dumitrusf/zoo-arcadia/blob/main/composer.json"
    click Composer_lock "https://github.com/dumitrusf/zoo-arcadia/blob/main/composer.lock"
    click Node_dep_pkg "https://github.com/dumitrusf/zoo-arcadia/blob/main/package.json"
    click Node_dep_lock "https://github.com/dumitrusf/zoo-arcadia/blob/main/package-lock.json"
```
