# chbandis/warehouse_management_android_app architecture

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

- Interactive diagram: https://gitdiagram.com/chbandis/warehouse_management_android_app
- Repository: https://github.com/chbandis/warehouse_management_android_app

## Overview

##### Client Layer (Android App)
- Three main UI components:
- QR Scanner Module
- Product View/List Interface
- Bottom Navigation Menu
- Local SQLite database component within the mobile device

##### Server Layer
- XAMPP Server container
- PHP API endpoints (CRUD operations)
- Global MySQL Database (warehouse DB)

##### Data Flow Components
- QR Code interaction
- Local-Global database synchronization
- API communication paths

##### Use a Three-Tier Architecture representation
- [Client Tier] <-> [API Tier] <-> [Data Tier]

##### Component Relationships
- Bidirectional sync between local and global databases
- QR code scanning flow to database storage
- User interaction flows
- API communication paths

Specific Implementation Details:

##### Top Section (Client)
- MainActivity
- QRScanner
- ViewProducts
- DBHandler and GlobalDBHandler as separate components

##### Middle Section (Communication)
- HTTP communication protocols

##### Bottom Section (Server)
- MySQL database with the 'products' table schema

Important Elements to Highlight:

##### Data Synchronization
- Synchronization flow between local SQLite and global MySQL
- Potential conflict points (mentioned in Known Issues)

##### Security Layer
- IP address configuration points
- Database connection security

##### Error Handling
- Potential failure points
- Error recovery paths

Additional Considerations:

- Initial setup flow
- Regular operation flow
- Error handling scenarios

Level of Detail:

- Keep high-level architecture clear and visible
- Critical configuration details in notes
- Both success and failure paths

##### Known issue areas and their planned solutions

Remember to maintain clarity while showing the complexity of the system, particularly the database synchronization aspects that are crucial for multi-branch warehouse operations.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client[Client Layer]
        direction TB
        AndroidDevice[Android Device]
        
        subgraph AppComponents[App Components]
            direction TB
            MainActivity["MainActivity"]:::activity
            QRScanner["QR Scanner"]:::activity
            ViewProducts["Product View Interface"]:::activity
            BottomNav["Bottom Navigation Menu"]:::ui
            ProductAdapter["Product Adapter"]:::component
            ProductModel["Product Model"]:::component
        end
        
        subgraph LocalStorage[Local Storage]
            direction TB
            SQLite[(SQLite DB)]:::database
            DBHandler["Local DB Handler"]:::handler
            GlobalDBHandler["Global DB Handler"]:::handler
        end
        
        MainActivity --> QRScanner
        MainActivity --> ViewProducts
        MainActivity --> BottomNav
        ViewProducts --> ProductAdapter
        ProductAdapter --> ProductModel
        ViewProducts --> DBHandler
        DBHandler --> SQLite
        GlobalDBHandler --> DBHandler
    end
    
    subgraph API[API Layer]
        direction TB
        AddProduct["Add Product API"]:::api
        DeleteProduct["Delete Product API"]:::api
    end
    
    subgraph Server[Server Layer]
        direction TB
        XAMPP["XAMPP Server"]:::server
        MySQL[(MySQL Database)]:::database
    end
    
    QRScanner --> AddProduct
    ViewProducts --> DeleteProduct
    GlobalDBHandler <--> AddProduct
    GlobalDBHandler <--> DeleteProduct
    AddProduct --> XAMPP
    DeleteProduct --> XAMPP
    XAMPP --> MySQL
    
    classDef activity fill:#4a90e2,stroke:#2e5b99,color:white
    classDef ui fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef component fill:#3498db,stroke:#2980b9,color:white
    classDef database fill:#27ae60,stroke:#219a52,color:white
    classDef handler fill:#e67e22,stroke:#d35400,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef server fill:#8e44ad,stroke:#6c3483,color:white
    
    click MainActivity "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/MainActivity.java"
    click QRScanner "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/QRScanner.java"
    click ViewProducts "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/ViewProducts.java"
    click BottomNav "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/res/menu/bottom_navigation_menu.xml"
    click ProductAdapter "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/ProductRVAdapter.java"
    click ProductModel "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/ProductModal.java"
    click DBHandler "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/DBHandler.java"
    click GlobalDBHandler "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/app/src/main/java/com/example/warehousemanagementapp/GlobalDBHandler.java"
    click AddProduct "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/CRUDAPI/addProduct.php"
    click DeleteProduct "https://github.com/chbandis/Warehouse_Management_Android_App/blob/main/CRUDAPI/deleteProduct.php"
```
