# kixxftw/software-design-ucu-merchandise-hub architecture

> Architecture diagram of the GitHub repository kixxftw/software-design-ucu-merchandise-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kixxftw/software-design-ucu-merchandise-hub
- Repository: https://github.com/kixxftw/software-design-ucu-merchandise-hub

## Overview

##### Project type and purpose
- This is a monolithic full-stack Flask web application (“UCU+ Merchandise Hub”) that provides user authentication, student dashboards, e-commerce (shopping cart, payments), admin panel, and integrates with external services (Google OAuth, GCash, Maya, Bank Transfer).

##### File structure
- Top level:
- run.py – Flask application entry point (WSGI server start, URL routes)
- appwrite.py, models.py, qrcode.py – application logic and data models
- requirements.txt – dependency list
- usersdb.sql – initial database schema
- /static – CSS, JS, images, uploaded product files
- /templates – Jinja2 HTML templates for pages (Index, Dashboard, Payment, Admin, etc.)
- Configuration implied via config.py/.env (database credentials, OAuth keys).
- No separate “frontend” vs “backend” repos: both live in this codebase—typical MVC pattern.

##### README for additional insights
- Detailed features: authentication (email + Google OAuth), student/instructor roles, shopping cart, order management, payment integrations.
- Technology stack: Flask, Flask-SQLAlchemy, MySQL, Flask-Login, Flask-Migrate, Flask-OAuth, external payment APIs, Jinja2, Bootstrap, jQuery.

##### Elements
- Labels for each component (e.g., “Flask App (run.py)”, “MySQL DB”, “Google OAuth2”)
- Blue for frontend/browser
- Orange for external APIs
- Gray for storage (filesystem)
- Detail critical flows:
- Authentication flow (local vs. OAuth)
- Checkout/payment flow
- Dashboard data retrieval

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        Browser["Web Browser"]:::frontend
        StaticCSS["Static CSS"]:::frontend
        StaticImages["Static Images"]:::frontend
        UploadedFiles["Uploaded Product Files"]:::frontend
        Templates["Jinja2 Templates"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        Controllers["Flask App (run.py)"]:::internal
        AppLogic["Service Functions (appwrite.py)"]:::internal
        QRModule["QR Module (qrcode.py)"]:::internal
        Models["Data Models (models.py)"]:::internal
    end

    %% Storage
    Database["MySQL Database"]:::storage
    FileStorage["Filesystem Storage"]:::storage

    %% External Services
    subgraph "External Services"
        GoogleOAuth["Google OAuth2 Provider"]:::external
        GCash["GCash API"]:::external
        Maya["Maya API"]:::external
        BankTransfer["Bank Transfer API"]:::external
        EmailService["SMTP Email Service"]:::external
    end

    %% Dependencies & Docs
    Requirements["Dependencies (requirements.txt)"]:::storage
    Schema["Initial DB Schema (usersdb.sql)"]:::storage
    README["README.md"]:::storage
    DesignDocs["Software Design Docs"]:::storage

    %% Relationships
    Browser -->|"HTTP Request"| Controllers
    Controllers -->|"renders"| Templates
    Controllers -->|"serves static"| StaticCSS
    Controllers -->|"serves static"| StaticImages
    Controllers -->|"serves static"| UploadedFiles
    Controllers -->|"calls"| AppLogic
    AppLogic -->|"uses ORM"| Models
    AppLogic -->|"generates QR"| QRModule
    AppLogic -->|"stores files"| FileStorage
    AppLogic -->|"reads/writes"| Database
    AppLogic -->|"invokes"| GCash
    AppLogic -->|"invokes"| Maya
    AppLogic -->|"invokes"| BankTransfer
    AppLogic -->|"sends email via"| EmailService
    Controllers -->|"redirects to"| GoogleOAuth
    Database -->|"initialized by"| Schema

    %% Click Events
    click Controllers "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/run.py"
    click AppLogic "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/appwrite.py"
    click QRModule "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/qrcode.py"
    click Models "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/models.py"
    click StaticCSS "https://github.com/kixxftw/software-design-ucu-merchandise-hub/tree/main/UCU+ Software Design/static/css/"
    click StaticImages "https://github.com/kixxftw/software-design-ucu-merchandise-hub/tree/main/UCU+ Software Design/static/images/"
    click UploadedFiles "https://github.com/kixxftw/software-design-ucu-merchandise-hub/tree/main/UCU+ Software Design/static/uploads/products/"
    click Templates "https://github.com/kixxftw/software-design-ucu-merchandise-hub/tree/main/UCU+ Software Design/templates/"
    click Requirements "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/requirements.txt"
    click Schema "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/usersdb.sql"
    click README "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/README.md"
    click DesignDocs "https://github.com/kixxftw/software-design-ucu-merchandise-hub/blob/main/UCU+ Software Design/FinalProject_Group2.pdf"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,stroke-width:1px
    classDef internal fill:#ABEBC6,stroke:#145A32,stroke-width:1px
    classDef storage fill:#D5DBDB,stroke:#424949,stroke-width:1px
    classDef external fill:#FAD7A0,stroke:#7D6608,stroke-width:1px
```
