# lukw07/zskam architecture

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

- Interactive diagram: https://gitdiagram.com/lukw07/zskam
- Repository: https://github.com/lukw07/zskam

## Overview

##### Project Type & Purpose
- This is a monolithic full-stack PHP web application for managing IT incidents and equipment reservations at a school.
- Key user flows: login/authentication, incident reporting & tracking, equipment reservation, administrative dashboards, email notifications.

##### File Structure
- Top-level PHP entry points (index.php, dashboard.php, admin.php, reservation.php, etc.) each correspond to a functional module.
- Shared includes:
- config.php (SMTP, DB credentials)
- db.php (MySQL connection)
- navbar.php (UI navigation)
- Assets: styles.css, auto_refresh.js
- Dependencies: vendor/ (Composer libraries)
- Deployment helper: deploy.py
- Database schema script: zskamenicka_rezv.sql

##### Extract Key Architectural Insights from README
- LAMP stack: PHP 7.4+, MySQL 5.7+, Apache/Nginx (implicit).
- Uses prepared statements, password_hash(), SMTP for emails.
- Monolithic codebase without microservices; logical separation by PHP script.

##### Main Components
a. Client Layer
- Web Browser (HTML/CSS/JS)
b. Web & Application Layer
- Web Server (Apache/Nginx) hosting PHP
- Authentication (index.php, auth.php, logout.php)
- Incident Management (dashboard.php, history.php, admin_issues.php, mark_read.php)
- Reservation Module (reservation.php, delete_reservation.php, admin_devices.php)
- Administration (admin.php, settings.php, statistics.php)
- Shared Services (config.php, db.php, navbar.php, vendor/)
- Notification Service (email sender via SMTP logic in PHP scripts)
c. Data Layer
- MySQL Database (schema imported from zskamenicka_rezv.sql)
- Optional: File System storage (uploads/) if attachments are used
d. External Services
- SMTP Server (for email notifications)

##### Relationships & Data Flows
- Browser → HTTP(S) → Web Server
- Web Server → invokes PHP application modules
- Application modules → SQL queries → MySQL
- Application modules → SMTP protocol → Email server

##### Architectural Patterns & Principles
- Layered architecture: Presentation → Business Logic → Data Access
- Monolith separated by functional modules (no separate microservices)
- Security best-practices: hashed passwords, prepared statements, input validation

##### Technologies & Frameworks
- PHP 7.4+, Composer packages (vendor/)
- MySQL 5.7+
- Frontend: CSS, vanilla JS (auto_refresh.js)
- Deployment: Python script (deploy.py), Dockerfile if containerized

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser\n(HTML/CSS/JS)"]:::external
    end

    %% Web & Application Layer
    subgraph "Web & Application Layer"
        WS["Web Server\n(Apache/Nginx + PHP 7.4+)"]:::app

        subgraph "Authentication Module"
            IDX["index.php"]:::php
            AUTH["auth.php"]:::php
            LOGOUT["logout.php"]:::php
        end

        subgraph "Incident Management Module"
            DASH["dashboard.php"]:::php
            HIST["history.php"]:::php
            ADMINISS["admin_issues.php"]:::php
            MARK["mark_read.php"]:::php
        end

        subgraph "Reservation Module"
            RESV["reservation.php"]:::php
            DELRES["delete_reservation.php"]:::php
            ADMDEV["admin_devices.php"]:::php
        end

        subgraph "Administration Module"
            ADMINP["admin.php"]:::php
            SETT["settings.php"]:::php
            STATS["statistics.php"]:::php
        end

        subgraph "Shared Services"
            CFG["config.php"]:::util
            DBCON["db.php"]:::util
            NAV["navbar.php"]:::util
            VENDOR["vendor/"]:::util
        end

        subgraph "Notification Service"
            NOTIF["Email Sender\n(SMTP Logic)"]:::util
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        DB["MySQL Database\n(zskamenicka_rezv.sql)"]:::db
    end

    %% External Services
    SMTP["SMTP Server"]:::external

    %% Connections
    Browser -->|"HTTP/HTTPS"| WS
    WS --> IDX
    WS --> DASH
    WS --> RESV
    WS --> ADMINP

    IDX --> CFG
    AUTH --> CFG
    LOGOUT --> CFG
    DASH --> CFG
    HIST --> CFG
    ADMINISS --> CFG
    MARK --> CFG
    RESV --> CFG
    DELRES --> CFG
    ADMDEV --> CFG
    ADMINP --> CFG
    SETT --> CFG
    STATS --> CFG

    CFG --> DBCON
    DBCON -->|"SQL Queries"| DB

    DASH --o|"email notifications"| NOTIF
    RESV --o|"reservation emails"| NOTIF
    NOTIF -->|"SMTP"| SMTP

    %% Click Events
    click IDX "https://github.com/lukw07/zskam/blob/main/index.php"
    click AUTH "https://github.com/lukw07/zskam/blob/main/auth.php"
    click LOGOUT "https://github.com/lukw07/zskam/blob/main/logout.php"
    click DASH "https://github.com/lukw07/zskam/blob/main/dashboard.php"
    click HIST "https://github.com/lukw07/zskam/blob/main/history.php"
    click ADMINISS "https://github.com/lukw07/zskam/blob/main/admin_issues.php"
    click MARK "https://github.com/lukw07/zskam/blob/main/mark_read.php"
    click RESV "https://github.com/lukw07/zskam/blob/main/reservation.php"
    click DELRES "https://github.com/lukw07/zskam/blob/main/delete_reservation.php"
    click ADMDEV "https://github.com/lukw07/zskam/blob/main/admin_devices.php"
    click ADMINP "https://github.com/lukw07/zskam/blob/main/admin.php"
    click SETT "https://github.com/lukw07/zskam/blob/main/settings.php"
    click STATS "https://github.com/lukw07/zskam/blob/main/statistics.php"
    click CFG "https://github.com/lukw07/zskam/blob/main/config.php"
    click DBCON "https://github.com/lukw07/zskam/blob/main/db.php"
    click NAV "https://github.com/lukw07/zskam/blob/main/navbar.php"
    click VENDOR "https://github.com/lukw07/zskam/tree/main/vendor/"
    click SMTP "https://github.com/lukw07/zskam/blob/main/zskamenicka_rezv.sql"
    click deploy "https://github.com/lukw07/zskam/blob/main/deploy.py"
    click Dockerfile "https://github.com/lukw07/zskam/tree/main/Dockerfile"

    %% Styles
    classDef external fill:#E3F2FD,stroke:#0D47A1,color:#0D47A1;
    classDef app fill:#E8F5E9,stroke:#1B5E20,color:#1B5E20;
    classDef php fill:#FFF3E0,stroke:#E65100,color:#E65100;
    classDef util fill:#F3E5F5,stroke:#4A148C,color:#4A148C;
    classDef db fill:#FFEBEE,stroke:#B71C1C,color:#B71C1C;
    class WS,DB,SMTP app;
    class NOTIF util;
    class CFG,DBCON,NAV,VENDOR util;
    class IDX,AUTH,LOGOUT,DASH,HIST,ADMINISS,MARK,RESV,DELRES,ADMDEV,ADMINP,SETT,STATS php
```
