# xmal0c/suppi-fi architecture

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

- Interactive diagram: https://gitdiagram.com/xmal0c/suppi-fi
- Repository: https://github.com/xmal0c/suppi-fi

## Overview

##### Main Components Identification

a) Frontend Layer
- User Interface Components (PHP Views)
- Static Assets (CSS, JS, Images)

b) Application Layer
- Authentication System (kirjaudu.php, ulos.php)
- Customer Management (asiakas.php, asiakashaku.php)
- Product Management (tuote.php)
- Rental Management (vuokraus.php)
- Sales Representative Management (myyja.php)
- Pricing System (hinta.php)

c) Database Layer
- MySQL Database (indicated by database.php and myyja.sql)

##### Component Organization

- [Client Browser] → [Web Server (Apache/Nginx)] → [MySQL Database]
- ↓                        ↓
- [Static Assets]        [PHP Application]

##### Detailed Component Breakdown

Create subdivisions for the application logic showing:

a) Core Modules:
- Authentication Module
- Customer Module
- Product Module
- Rental Module
- Sales Module
- Pricing Module

b) Shared Components:
- Database Connection (inc/database.php)
- Utility Functions (inc/funktiot.php)
- Common Templates (inc/header.php, inc/footer.php, inc/nav.php)

##### Data Flow Indicators

- User request flow
- Database queries
- Authentication flow
- CRUD operations flow

##### Implementation Details

Technical aspects:
- PHP files serving as controllers
- Static asset delivery
- Database interaction points
- Template inclusion system

##### Top Level (User Interface)
- [Browser] → [Static Assets (CSS/JS/Images)]
- ↓
- [Authentication Layer (kirjaudu.php)]
- ↓
- [Navigation Component (inc/nav.php)]

##### Middle Level (Business Logic)
- [Customer Management] ↔ [Rental Management] ↔ [Product Management]
- ↕                       ↕                    ↕
- [Price Management]   ↔   [Sales Rep Management]

##### Bottom Level (Data Layer)
- [Database Connection Layer (inc/database.php)]
- ↓
- [MySQL Database (myyja.sql)]

Additional Notes:
- Notes for important business rules or constraints
- Error handling paths
- Session state management points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        StaticAssets["Static Assets"]:::static
    end

    subgraph "Web Server"
        Auth["Authentication System"]:::auth
        
        subgraph "Customer Management"
            CustMain["Customer Interface"]:::customer
            CustSearch["Customer Search"]:::customer
            CustView["Customer View"]:::customer
            CustAdd["Add Customer"]:::customer
            CustUpdate["Update Customer"]:::customer
            CustDelete["Delete Customer"]:::customer
        end
        
        subgraph "Product Management"
            ProdMain["Product Interface"]:::product
            ProdAdd["Add Product"]:::product
        end
        
        subgraph "Rental Management"
            RentMain["Rental Interface"]:::rental
            RentCurrent["Currently Rented"]:::rental
            RentSuccess["Rental Success"]:::rental
            RentReturn["Returns Handler"]:::rental
        end
        
        subgraph "Sales Management"
            SalesMain["Sales Rep Interface"]:::sales
            SalesAdd["Add Sales Rep"]:::sales
        end
        
        subgraph "Pricing System"
            PriceMain["Price Interface"]:::pricing
            PriceAdd["Add Price"]:::pricing
        end
        
        subgraph "Shared Components"
            DB_Conn["Database Connection"]:::shared
            Utils["Utility Functions"]:::shared
            Header["Header Template"]:::shared
            Footer["Footer Template"]:::shared
            Nav["Navigation"]:::shared
        end
    end
    
    subgraph "Database Layer"
        MySQL["MySQL Database"]:::database
    end
    
    %% Connections
    Browser --> StaticAssets
    Browser --> Auth
    Auth --> Nav
    
    Nav --> CustMain
    Nav --> ProdMain
    Nav --> RentMain
    Nav --> SalesMain
    Nav --> PriceMain
    
    CustMain --> DB_Conn
    ProdMain --> DB_Conn
    RentMain --> DB_Conn
    SalesMain --> DB_Conn
    PriceMain --> DB_Conn
    
    DB_Conn --> MySQL
    
    %% Component Mappings
    click StaticAssets "https://github.com/xMal0c/suppi-fi/tree/master/css,js,img,banner,logo"
    click Auth "https://github.com/xMal0c/suppi-fi/blob/master/kirjaudu.php"
    click CustMain "https://github.com/xMal0c/suppi-fi/blob/master/asiakas.php"
    click CustSearch "https://github.com/xMal0c/suppi-fi/blob/master/asiakashaku.php"
    click CustView "https://github.com/xMal0c/suppi-fi/blob/master/katso_asiakas.php"
    click CustAdd "https://github.com/xMal0c/suppi-fi/blob/master/lisaa_asiakas.php"
    click CustUpdate "https://github.com/xMal0c/suppi-fi/blob/master/paivita_asiakas.php"
    click CustDelete "https://github.com/xMal0c/suppi-fi/blob/master/poista_asiakas.php"
    click ProdMain "https://github.com/xMal0c/suppi-fi/blob/master/tuote.php"
    click ProdAdd "https://github.com/xMal0c/suppi-fi/blob/master/lisaa_tuote.php"
    click RentMain "https://github.com/xMal0c/suppi-fi/blob/master/vuokraus.php"
    click RentCurrent "https://github.com/xMal0c/suppi-fi/blob/master/vuokralla.php"
    click RentSuccess "https://github.com/xMal0c/suppi-fi/blob/master/vuokraus_onnistui.php"
    click RentReturn "https://github.com/xMal0c/suppi-fi/blob/master/palautettu.php"
    click SalesMain "https://github.com/xMal0c/suppi-fi/blob/master/myyja.php"
    click SalesAdd "https://github.com/xMal0c/suppi-fi/blob/master/lisaa_myyja.php"
    click PriceMain "https://github.com/xMal0c/suppi-fi/blob/master/hinta.php"
    click PriceAdd "https://github.com/xMal0c/suppi-fi/blob/master/lisaa_hinta.php"
    click DB_Conn "https://github.com/xMal0c/suppi-fi/blob/master/inc/database.php"
    click Utils "https://github.com/xMal0c/suppi-fi/blob/master/inc/funktiot.php"
    click Header "https://github.com/xMal0c/suppi-fi/blob/master/inc/header.php"
    click Footer "https://github.com/xMal0c/suppi-fi/blob/master/inc/footer.php"
    click Nav "https://github.com/xMal0c/suppi-fi/blob/master/inc/nav.php"
    click MySQL "https://github.com/xMal0c/suppi-fi/blob/master/myyja.sql"
    
    %% Styles
    classDef static fill:#e6e6e6
    classDef auth fill:#ff9999
    classDef customer fill:#99ff99
    classDef product fill:#9999ff
    classDef rental fill:#ffff99
    classDef sales fill:#ff99ff
    classDef pricing fill:#99ffff
    classDef shared fill:#ffc266
    classDef database fill:#ffb366
```
