# wailamari/autofair architecture

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

- Interactive diagram: https://gitdiagram.com/wailamari/autofair
- Repository: https://github.com/wailamari/autofair

## Overview

##### Project Type & Purpose
- This is a simple full-stack PHP web application demonstrating an MVC-based login page backed by a MySQL database.
- It uses WAMP (Apache + PHP + MySQL) for hosting, follows an MVC directory layout, and includes example data scripts and tests.

##### File Structure Analysis
- Top level:
- README.md / README.html – project description & MVC primer
- loginController.php, main_page.php – controller entrypoints
- fillDB.php, testUserModel.php – utility/test scripts
- styles/ – CSS assets (example.css, main_styles.css)
- scripts/php/ – backend code broken into subfolders:
– env_settings.php – DB connection config
– models/ (DBModel.php, UserModel.php) – data‐access layer
– views/ (includes.php, loginExample.php, welcomePage.php) – presentation layer
- scripts/sql/user.sql – initial “users” table dump

##### README Insights
- The README explicitly calls out MVC architecture, describes installation (WAMP + virtual host), database setup, and MVC flow rules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Layer"
        Browser["Client Browser"]:::client
    end

    subgraph "Web Server (Apache + PHP)"
        Server["Apache/PHP (WAMP)"]:::server
    end

    subgraph "Controllers Layer"
        LoginCtrl["loginController.php"]:::controller
        MainCtrl["main_page.php"]:::controller
    end

    subgraph "Configuration & Models"
        Env["env_settings.php"]:::config
        DBBase["DBModel"]:::model
        UserModel["UserModel"]:::model
    end

    subgraph "Views & Static Assets"
        Includes["includes.php"]:::view
        LoginView["loginExample.php"]:::view
        WelcomeView["welcomePage.php"]:::view
        CSSEx["example.css"]:::static
        CSSMain["main_styles.css"]:::static
        Images["Images"]:::static
        Diagrams["Diagrams"]:::static
    end

    subgraph "Database"
        MySQL["MySQL DB"]:::db
    end

    subgraph "Utility Scripts"
        FillDB["fillDB.php"]:::utility
        TestUM["testUserModel.php"]:::utility
    end

    Browser -->|"HTTP request"| Server
    Server -->|"routes to"| LoginCtrl
    Server -->|"routes to"| MainCtrl

    LoginCtrl -->|"loads config"| Env
    MainCtrl -->|"loads config"| Env

    LoginCtrl -->|"instantiates"| DBBase
    MainCtrl -->|"instantiates"| DBBase

    DBBase -->|"extended by"| UserModel

    LoginCtrl -->|"calls UserModel"| UserModel
    MainCtrl -->|"calls UserModel"| UserModel

    UserModel -->|"SELECT * FROM users"| MySQL
    MySQL -->|"returns result set"| UserModel

    LoginCtrl -->|"processes logic"| LoginView
    MainCtrl -->|"processes logic"| WelcomeView

    LoginView -->|"includes view logic"| Includes
    WelcomeView -->|"includes view logic"| Includes

    LoginView -->|"renders HTML + CSS"| Browser
    WelcomeView -->|"renders HTML + CSS"| Browser

    Server -->|"serves static"| CSSEx
    Server -->|"serves static"| CSSMain
    Server -->|"serves static"| Images
    Server -->|"serves static"| Diagrams

    FillDB -->|"executes SQL script"| MySQL
    TestUM -->|"tests"| UserModel

    click LoginCtrl "https://github.com/wailamari/autofair/blob/main/loginController.php"
    click MainCtrl "https://github.com/wailamari/autofair/blob/main/main_page.php"
    click Env "https://github.com/wailamari/autofair/blob/main/scripts/php/env_settings.php"
    click DBBase "https://github.com/wailamari/autofair/blob/main/scripts/php/models/DBModel.php"
    click UserModel "https://github.com/wailamari/autofair/blob/main/scripts/php/models/UserModel.php"
    click Includes "https://github.com/wailamari/autofair/blob/main/scripts/php/views/includes.php"
    click LoginView "https://github.com/wailamari/autofair/blob/main/scripts/php/views/loginExample.php"
    click WelcomeView "https://github.com/wailamari/autofair/blob/main/scripts/php/views/welcomePage.php"
    click FillDB "https://github.com/wailamari/autofair/blob/main/fillDB.php"
    click TestUM "https://github.com/wailamari/autofair/blob/main/testUserModel.php"
    click CSSEx "https://github.com/wailamari/autofair/blob/main/styles/example.css"
    click CSSMain "https://github.com/wailamari/autofair/blob/main/styles/main_styles.css"
    click Images "https://github.com/wailamari/autofair/tree/main/images/"
    click Diagrams "https://github.com/wailamari/autofair/tree/main/figs/"
    classDef client fill:#add8e6,stroke:#000,stroke-width:1px
    classDef server fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef controller fill:#87cefa,stroke:#000,stroke-width:1px
    classDef config fill:#fffacd,stroke:#000,stroke-width:1px
    classDef model fill:#fff8dc,stroke:#000,stroke-width:1px
    classDef view fill:#98fb98,stroke:#000,stroke-width:1px
    classDef static fill:#90ee90,stroke:#000,stroke-width:1px
    classDef db fill:#ffa500,stroke:#000,stroke-width:1px
    classDef utility fill:#ffb6c1,stroke:#000,stroke-width:1px
```
