# vital1tch/virtual-zoo architecture

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

- Interactive diagram: https://gitdiagram.com/vital1tch/virtual-zoo
- Repository: https://github.com/vital1tch/virtual-zoo

## Overview

##### Project type and purpose
- This is a monolithic full-stack web application built on Laravel (PHP MVC framework).
- Purpose: “Virtual Zoo” lets users CRUD Animals and Cages, view modals of animals in a cage, handle cage-to-animal relations, issue notifications, and store uploaded images.

##### File structure
- Top-level:
- app/ — Laravel MVC core (Http/Controllers, Models, Providers)
- config/ — framework and service configs
- database/ — migrations, factories, seeders
- public/ — web root (index.php, CSS, assets)
- resources/ — Blade templates, raw CSS/JS, images
- routes/ — route definitions (web.php, console.php)
- storage/ — cached files, sessions, image uploads
- bootstrap/ — framework bootstrapper
- Patterns:
- MVC (Controllers invoke Models, return Blade Views)
- Eloquent ORM for database
- Blade templating for server-side rendering
- Vite (vite.config.js) to bundle frontend assets
- Config/build/deploy files: .env, composer.json, package.json, artisan, phpunit.xml

##### Extract README insights
- Features: add/edit/delete Animals & Cages, auto-reassign when deleting filled cages, session-flash notifications, modal windows for list views.
- Tech: Laravel, MySQL (via .env), Blade, JS/CSS assets, storage link for animal photos.

- Components:
- Rectangles grouped by layer (Client, Web Server, Laravel App, Database, File System)
– Blue for client/UI
– Green for Laravel core
– Orange for Database
– Gray for File System & Storage
- Labels:
- Port/URLs if helpful (e.g., 127.0.0.1:8000)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        B["Web Browser"]:::browser
    end

    subgraph "Web Server"
        PI["public/index.php"]:::server
    end

    subgraph "Laravel Application"
        subgraph "Bootstrap & HTTP Layer"
            K["HTTP Kernel"]:::server
            M["Middleware"]:::server
        end

        subgraph "Routing Layer"
            Rw["routes/web.php"]:::code
            Rc["routes/console.php"]:::code
        end

        subgraph "Controllers"
            AC["AnimalController"]:::controller
            CC["CageController"]:::controller
            HC["HomeController"]:::controller
        end

        subgraph "Models"
            AM["Eloquent Model: Animal"]:::model
            CM["Eloquent Model: Cage"]:::model
            UM["Eloquent Model: User"]:::model
        end

        subgraph "Views"
            Vlayout["Layouts Directory"]:::view
            Vwel["welcome.blade.php"]:::view
            subgraph "Animal Views"
                Va1["create.blade.php"]:::view
                Va2["edit.blade.php"]:::view
                Va3["show.blade.php"]:::view
            end
            subgraph "Cage Views"
                Vc1["create.blade.php"]:::view
                Vc2["edit.blade.php"]:::view
            end
        end

        SP["AppServiceProvider"]:::provider
    end

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

    subgraph "Storage & Cache"
        FS1["storage/app/public (Images)"]:::fs
        FS2["storage/framework/cache & sessions"]:::fs
    end

    subgraph "Asset Pipeline"
        VC["vite.config.js"]:::code
        CSSsrc["resources/css/app.css"]:::code
        JSsrc["resources/js/app.js & bootstrap.js"]:::code
        CSSout["public/css/styles.css"]:::asset
        JSout["public/js/app.js"]:::asset
    end

    B -->|"HTTP GET/POST"| PI
    PI -->|"Bootstrap"| K
    K --> M
    M --> Rw
    Rw --> AC
    Rw --> CC
    Rw --> HC

    AC -->|uses| AM
    CC -->|uses| CM
    HC -->|uses| UM

    AM -->|"SELECT/CRUD"| DB
    CM -->|"SELECT/CRUD"| DB
    UM -->|"SELECT/CRUD"| DB

    AC -->|renders| Va1
    AC -->|renders| Va2
    AC -->|renders| Va3
    CC -->|renders| Vc1
    CC -->|renders| Vc2
    HC -->|renders| Vwel
    AC -->|may use| Vlayout
    CC -->|may use| Vlayout
    HC -->|may use| Vlayout

    Va1 -->|HTML| B
    Vc1 -->|HTML| B
    Vwel -->|HTML| B

    AC -->|"save image"| FS1
    M -->|"cache/session"| FS2

    CSSsrc --> VC
    JSsrc --> VC
    VC --> CSSout
    VC --> JSout
    B -->|fetch assets| CSSout
    B -->|fetch assets| JSout

    classDef browser fill:#CCE5FF,stroke:#004085,color:#004085;
    classDef server fill:#D4EDDA,stroke:#155724,color:#155724;
    classDef controller fill:#FFF3CD,stroke:#856404,color:#856404;
    classDef model fill:#F8D7DA,stroke:#721C24,color:#721C24;
    classDef view fill:#E2E3E5,stroke:#6C757D,color:#6C757D;
    classDef provider fill:#D1ECF1,stroke:#0C5460,color:#0C5460;
    classDef db fill:#FDE2E2,stroke:#C53030,color:#C53030;
    classDef fs fill:#E8EAF6,stroke:#3F51B5,color:#3F51B5;
    classDef code fill:#FFF5E5,stroke:#D97706,color:#D97706;
    classDef asset fill:#E6FFFA,stroke:#065F46,color:#065F46;

    click PI "https://github.com/vital1tch/virtual-zoo/blob/master/public/index.php"
    click Rw "https://github.com/vital1tch/virtual-zoo/blob/master/routes/web.php"
    click Rc "https://github.com/vital1tch/virtual-zoo/blob/master/routes/console.php"
    click AC "https://github.com/vital1tch/virtual-zoo/blob/master/app/Http/Controllers/AnimalController.php"
    click CC "https://github.com/vital1tch/virtual-zoo/blob/master/app/Http/Controllers/CageController.php"
    click HC "https://github.com/vital1tch/virtual-zoo/blob/master/app/Http/Controllers/HomeController.php"
    click AM "https://github.com/vital1tch/virtual-zoo/blob/master/app/Models/Animal.php"
    click CM "https://github.com/vital1tch/virtual-zoo/blob/master/app/Models/Cage.php"
    click UM "https://github.com/vital1tch/virtual-zoo/blob/master/app/Models/User.php"
    click Va1 "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/animals/create.blade.php"
    click Va2 "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/animals/edit.blade.php"
    click Va3 "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/animals/show.blade.php"
    click Vc1 "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/cages/create.blade.php"
    click Vc2 "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/cages/edit.blade.php"
    click Vlayout "https://github.com/vital1tch/virtual-zoo/tree/master/resources/views/layouts/"
    click Vwel "https://github.com/vital1tch/virtual-zoo/blob/master/resources/views/welcome.blade.php"
    click SP "https://github.com/vital1tch/virtual-zoo/blob/master/app/Providers/AppServiceProvider.php"
    click FS1 "https://github.com/vital1tch/virtual-zoo/tree/master/storage/app/public/"
    click FS2 "https://github.com/vital1tch/virtual-zoo/tree/master/storage/framework/cache/"
    click VC "https://github.com/vital1tch/virtual-zoo/blob/master/vite.config.js"
    click CSSsrc "https://github.com/vital1tch/virtual-zoo/blob/master/resources/css/app.css"
    click JSsrc "https://github.com/vital1tch/virtual-zoo/blob/master/resources/js/app.js"
```
