# llagerlof/freezer architecture

> Architecture diagram of the GitHub repository llagerlof/freezer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/llagerlof/freezer
- Repository: https://github.com/llagerlof/freezer

## Overview

##### Main Components Identification
The system consists of these primary components:

a) Frontend Layer:
- Static web interface (HTML/CSS/JS)
- Pure CSS framework for styling
- AJAX-based communication with backend

b) Backend Layer:
- PHP-based API endpoints
- Database connection management
- Comparison logic
- Response handling

c) External Components:
- Target MySQL/MariaDB database (monitored database)
- Third-party application being monitored (e.g., Moodle, HumHub)

##### Flow Representation

a) User Interactions:
→ Freeze operation flow
→ Comparison operation flow
→ Database selection flow

b) Data Flow:
→ Database snapshot creation
→ Difference calculation
→ Results return path

##### Specific Implementation Details

a) API Endpoints:
- freezer.freeze.json.php
- freezer.diff.json.php
- freezer.combo.json.php

b) Core Classes:
- Freezer.php (main functionality)
- ResponseJson.php (response handling)

##### Technical Notes

Annotations for:
- PDO database connection requirement
- Local development environment focus
- SELECT/DESC/SHOW TABLES operation limitations
- Security considerations (no authentication)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        UI["User Interface"]:::frontend
        click UI "https://github.com/llagerlof/freezer/blob/master/index.htm"
        
        subgraph Frontend["Frontend Components"]
            JS["JavaScript Module"]:::frontend
            click JS "https://github.com/llagerlof/freezer/blob/master/js/index.js"
            CSS["CSS Styles"]:::frontend
            click CSS "https://github.com/llagerlof/freezer/blob/master/css/pure-min.css"
            CustomCSS["Custom Styles"]:::frontend
            click CustomCSS "https://github.com/llagerlof/freezer/blob/master/css/index.css"
            LoadingCSS["Loading Animation"]:::frontend
            click LoadingCSS "https://github.com/llagerlof/freezer/blob/master/css/loading-icon.css"
        end
        
        UI --> JS
        UI --> CSS
        UI --> CustomCSS
        UI --> LoadingCSS
    end

    subgraph Server["Server Layer"]
        Config["Configuration"]:::backend
        click Config "https://github.com/llagerlof/freezer/blob/master/config/freezer.example.php"
        
        subgraph API["API Endpoints"]
            FreezeAPI["Freeze Endpoint"]:::api
            click FreezeAPI "https://github.com/llagerlof/freezer/blob/master/json/freezer.freeze.json.php"
            DiffAPI["Diff Endpoint"]:::api
            click DiffAPI "https://github.com/llagerlof/freezer/blob/master/json/freezer.diff.json.php"
            ComboAPI["Combo Endpoint"]:::api
            click ComboAPI "https://github.com/llagerlof/freezer/blob/master/json/freezer.combo.json.php"
        end
        
        subgraph Core["Core Components"]
            Freezer["Freezer Class"]:::backend
            click Freezer "https://github.com/llagerlof/freezer/blob/master/class/Freezer.php"
            Response["ResponseJson Class"]:::backend
            click Response "https://github.com/llagerlof/freezer/blob/master/class/ResponseJson.php"
        end
    end

    subgraph Database["Database Layer"]
        TargetDB[("Target MySQL/MariaDB")]:::database
        Snapshots[("Snapshot Storage")]:::database
    end

    %% Connections
    Browser --> UI
    JS --> FreezeAPI
    JS --> DiffAPI
    JS --> ComboAPI
    
    FreezeAPI --> Freezer
    DiffAPI --> Freezer
    ComboAPI --> Freezer
    
    Freezer --> Response
    Freezer --> Config
    
    Freezer --> TargetDB
    Freezer --> Snapshots

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:#fff
    classDef backend fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef api fill:#e74c3c,stroke:#c0392b,color:#fff
    classDef database fill:#f39c12,stroke:#d35400,color:#fff

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        API_L["API Endpoint"]:::api
        DB_L["Database"]:::database
    end

    %% Notes
    note["Note: Development tool for localhost usage only<br/>Requires PDO database connection<br/>Version: 0.17.0"]
    style note fill:#f8f9fa,stroke:#dee2e6
```
