# fkchaud/penapp architecture

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

- Interactive diagram: https://gitdiagram.com/fkchaud/penapp
- Repository: https://github.com/fkchaud/penapp

## Overview

##### Main Components

a) Client-Side (Mobile Application):
- React Native/Expo Layer
- Route Structure (based on the app directory)
- Component Layer
- Hooks Layer
- Utils & Constants

b) Platform-Specific Components:
- iOS Implementation
- Android Implementation

##### Architectural Layers

**┌─────────────────────────────────────────────────────┐**
- User Interface                      │
- ┤
- Business Logic                      │
- ┤
- Platform Specific                     │
- ┘

##### Detailed Component Breakdown

a) User Interface Layer (Rectangle, Blue):
- Order Management Views
- Waiter Interface
- Chef Interface
- Cashier Interface
- Order Taking Components
- Common Components (Cards, Listings)

b) Business Logic Layer (Hexagon, Green):
- API Integration (useApi hook)
- Theme Management
- Table Management
- Order Processing Logic

c) Platform Layer (Rounded Rectangle, Gray):
- iOS Native Modules
- Android Native Modules
- Expo SDK Integration

##### Data Flow Representation

- User interaction flow
- Order status transitions
- Data synchronization between components
- API communication patterns

##### Key Elements to Highlight

a) Role-Based Access:
- Waiter Flow
- Chef Flow
- Cashier Flow

b) Core Features:
- Order Management
- Table Management
- Manual Order Entry
- Order Status Tracking

##### Implementation Details

Use annotations to indicate:
- TailwindCSS styling implementation
- Expo Router usage
- Native platform integrations

**┌─────────────────────────────────────────────────────┐**
- Frontend                         │
- ┬─────────────────┬────────────┤
- Waiter Module    │   Chef Module   │  Cashier   │
- ┴─────────────────┴────────────┤
- Common Components                     │
- ┤
- Business Logic                     │
- ┤
- Platform Integration                   │
- ┘

##### Data flow patterns

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that impact the system's overall structure and behavior.

- The application's overall architecture
- Component relationships and dependencies
- Data flow patterns
- Platform-specific considerations
- Role-based access control implementation

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User Interface Layer"
        direction TB
        UI_ROLES[Role-Based Interfaces]
        
        subgraph "Role Modules"
            direction TB
            WAITER[Waiter Interface]
            CHEF[Chef Interface]
            CASHIER[Cashier Interface]
        end

        subgraph "Order Management"
            direction TB
            ORDER_CARD[Order Card]
            ORDER_LIST[Order Listing]
            ORDER_DISPLAY[Order Masonry]
        end

        subgraph "Order Taking System"
            direction TB
            FOOD_PICKER[Food Picker]
            CONFIRM_ORDER[Order Confirmation]
            TABLE_TOPBAR[Table Top Bar]
        end

        subgraph "Navigation Components"
            direction TB
            MAIN_LAYOUT[Main Layout]
            TOP_BAR[Top Navigation]
            BOTTOM_BAR[Bottom Navigation]
        end

        MANUAL_ORDER[Manual Order Entry]
    end

    subgraph "Business Logic Layer"
        direction TB
        API_INTEGRATION[API Integration]
        TABLE_MGMT[Table Management]
        
        subgraph "Theme System"
            direction TB
            COLOR_SCHEME[Color Scheme]
            THEME_HOOK[Theme Hook]
            GLOBAL_STYLES[Global Styles]
        end
    end

    subgraph "Platform Layer"
        direction TB
        IOS[iOS Implementation]
        ANDROID[Android Implementation]
    end

    %% Relationships
    UI_ROLES --> WAITER & CHEF & CASHIER
    WAITER & CHEF & CASHIER --> ORDER_MANAGEMENT
    ORDER_MANAGEMENT --> API_INTEGRATION
    TABLE_TOPBAR --> TABLE_MGMT
    MANUAL_ORDER --> API_INTEGRATION

    %% Click Events
    click WAITER "https://github.com/fkchaud/penapp/tree/master/app/waiter/"
    click CHEF "https://github.com/fkchaud/penapp/tree/master/app/chef/"
    click CASHIER "https://github.com/fkchaud/penapp/tree/master/app/cashier/"
    click ORDER_CARD "https://github.com/fkchaud/penapp/blob/master/components/OrderCard.tsx"
    click ORDER_LIST "https://github.com/fkchaud/penapp/blob/master/components/OrderListing.tsx"
    click ORDER_DISPLAY "https://github.com/fkchaud/penapp/blob/master/components/OrderMasonry.tsx"
    click FOOD_PICKER "https://github.com/fkchaud/penapp/blob/master/components/OrderTaking/FoodPicker.tsx"
    click CONFIRM_ORDER "https://github.com/fkchaud/penapp/blob/master/components/OrderTaking/ConfirmOrderModal.tsx"
    click TABLE_TOPBAR "https://github.com/fkchaud/penapp/blob/master/components/OrderTaking/TableTopBar.tsx"
    click IOS "https://github.com/fkchaud/penapp/tree/master/ios/"
    click ANDROID "https://github.com/fkchaud/penapp/tree/master/android/"
    click API_INTEGRATION "https://github.com/fkchaud/penapp/blob/master/hooks/useApi.tsx"
    click TABLE_MGMT "https://github.com/fkchaud/penapp/blob/master/utils/tables.ts"
    click COLOR_SCHEME "https://github.com/fkchaud/penapp/blob/master/constants/Colors.ts"
    click GLOBAL_STYLES "https://github.com/fkchaud/penapp/blob/master/css/global.css"
    click THEME_HOOK "https://github.com/fkchaud/penapp/blob/master/hooks/useThemeColor.ts"
    click MAIN_LAYOUT "https://github.com/fkchaud/penapp/blob/master/app/_layout.tsx"
    click TOP_BAR "https://github.com/fkchaud/penapp/blob/master/components/TopBar.tsx"
    click BOTTOM_BAR "https://github.com/fkchaud/penapp/blob/master/components/BottomBar.tsx"
    click MANUAL_ORDER "https://github.com/fkchaud/penapp/blob/master/app/add_manual_order.tsx"

    %% Styling
    classDef interface fill:#a8dadc,stroke:#457b9d
    classDef logic fill:#2a9d8f,stroke:#264653
    classDef platform fill:#e9c46a,stroke:#f4a261
    classDef navigation fill:#e76f51,stroke:#9b2226

    class WAITER,CHEF,CASHIER interface
    class API_INTEGRATION,TABLE_MGMT,COLOR_SCHEME,THEME_HOOK,GLOBAL_STYLES logic
    class IOS,ANDROID platform
    class MAIN_LAYOUT,TOP_BAR,BOTTOM_BAR navigation
```
