# hengypinn/streamlit_coffeeapp architecture

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

- Interactive diagram: https://gitdiagram.com/hengypinn/streamlit_coffeeapp
- Repository: https://github.com/hengypinn/streamlit_coffeeapp

## Overview

##### Main Components

A. Frontend Layer (Streamlit):
- Customer Interface
- Admin Interface
- UI Components (Menu, Orders, Analytics Dashboard)

B. Backend Services:
- Authentication Service (auth.py)
- Order Management Service (order.py)
- Inventory Management Service (inventory.py)
- Analytics Engine (analytics.py)
- Notification System (notification.py, pickup_notification.py)
- Promotions Handler (promotions.py)

C. External Services:
- Firebase Firestore (Database)
- Stripe Payment Gateway
- Image Storage System

**[Client Layer]**
- ↕
**[Application Layer]**
- ↕
**[Data Layer]**

##### Component Relationships

- Data flow between services and Firebase Firestore
- Payment processing flow through Stripe
- Notification system's interaction with both customers and admins

##### Specific Elements

A. User Interaction Flow:
**Customer/Admin → Streamlit Frontend → Authentication → Backend Services → Database**

B. Core Service Modules:
**Order Management ←→ Inventory System**
- ↕
**Analytics Engine ←→ Sales Reporting**
- ↕
**Notification System ←→ Customer Alerts**

C. Integration Points:
- Firebase initialization and configuration
- Stripe payment processing flow
- Real-time notification system

##### Additional Details

Subsystems for:
- Menu management
- Order processing workflow
- Inventory tracking
- Promotional campaign handling
- Customer feedback loop

##### Technical Stack Indicators

- Streamlit for frontend
- Firebase Firestore for database
- Stripe for payments
- Plotly for data visualization
- Python as the primary language

Remember to include annotations for scalability considerations and potential system bottlenecks, as this will be valuable for future development and optimization efforts.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        UI[Streamlit UI]:::frontend
        CustomerUI[Customer Interface]:::frontend
        AdminUI[Admin Interface]:::frontend
        AboutUs[About Us]:::frontend
    end

    %% Backend Services Layer
    subgraph Services
        Main[Main Application]:::backend
        Auth[Authentication Service]:::auth
        OrderMgmt[Order Management]:::backend
        InventoryMgmt[Inventory Management]:::backend
        Analytics[Analytics Engine]:::backend
        Notifications[Notification System]:::backend
        Promotions[Promotions Handler]:::backend
        Menu[Menu Management]:::backend
        Sales[Sales Reporting]:::backend
        Feedback[Customer Feedback]:::backend
        Utils[Utility Functions]:::backend
        Config[Configuration]:::backend
    end

    %% External Services Layer
    subgraph External
        Firebase[Firebase Firestore]:::database
        Stripe[Stripe Payment]:::external
        ImageStore[Image Storage]:::external
    end

    %% Relationships
    UI --> |Authentication| Auth
    UI --> CustomerUI
    UI --> AdminUI
    UI --> AboutUs
    
    CustomerUI --> OrderMgmt
    CustomerUI --> Menu
    CustomerUI --> Feedback
    
    AdminUI --> InventoryMgmt
    AdminUI --> Analytics
    AdminUI --> Sales
    AdminUI --> Promotions
    
    Main --> Auth
    Main --> OrderMgmt
    Main --> InventoryMgmt
    
    OrderMgmt --> Notifications
    OrderMgmt --> Stripe
    OrderMgmt --> Firebase
    
    InventoryMgmt --> Firebase
    Analytics --> Firebase
    Notifications --> Firebase
    Promotions --> Firebase
    Menu --> Firebase
    Sales --> Firebase
    Feedback --> Firebase
    
    %% Click Events
    click Main "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/main.py"
    click Auth "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/auth.py"
    click OrderMgmt "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/order.py"
    click InventoryMgmt "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/inventory.py"
    click Analytics "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/analytics.py"
    click Notifications "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/notification.py"
    click Promotions "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/promotions.py"
    click Menu "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/menu.py"
    click Sales "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/sales_reporting.py"
    click Feedback "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/feedback.py"
    click Config "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/constants.py"
    click Utils "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/utils.py"
    click AboutUs "https://github.com/HengYpinn/streamlit_CoffeeApp/blob/main/about_us.py"
    click ImageStore "https://github.com/HengYpinn/streamlit_CoffeeApp/tree/main/images"

    %% Legend
    subgraph Legend
        L1[Frontend Component]:::frontend
        L2[Backend Service]:::backend
        L3[Database]:::database
        L4[External Service]:::external
        L5[Auth Service]:::auth
    end
```
