# syed-abdullah-g/foodex architecture

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

- Interactive diagram: https://gitdiagram.com/syed-abdullah-g/foodex
- Repository: https://github.com/syed-abdullah-g/foodex

## Overview

##### Main Components

a. Client-Side (Mobile Application):
- Frontend Layer (Flutter UI)
- Consumer Interface
- Merchant Interface
- Authentication Screens
- Payment Screens
- Order Management Screens

b. Backend Services:
- Firebase Services
- Authentication
- Database (Firestore/Realtime Database)
- Cloud Functions (if any)
- Razorpay Payment Gateway
- Payment Processing
- Order Management

##### Architecture Patterns to Highlight

- Provider Pattern (State Management)
- Connection between providers/ directory and UI components
- Model-View Architecture
- Models (from models/ directory)
- Views (from screen/ and widgets/ directories)

##### Component Organization

- Blue rectangles: Flutter UI components
- Green rectangles: Provider state management
- Orange rectangles: External services (Firebase, Razorpay)
- Yellow rectangles: Data models
- Purple rectangles: Platform-specific implementations

##### Specific Implementation Details

Key features:
- Multi-platform support (iOS, Android, Web)
- Payment integration with Razorpay
- User role separation (Consumer/Merchant)
- Order management system
- Area-based services (based on area_names.dart)

##### Additional Elements

Include:
- Version information
- Platform support indicators
- External service dependencies
- Data flow directions

Key Considerations:
- Clear separation between consumer and merchant flows
- Payment processing pipeline
- Demonstrate how state management integrates with UI
- Error handling and fallback flows
- Platform-specific implementations where relevant

Remember to:
- Major system interactions
- Maintain appropriate level of detail
- Notes for complex interactions
- Security boundaries
- Third-party service integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "UI Layer"
        direction TB
        ConsumerUI["Consumer Interface"]:::ui
        MerchantUI["Merchant Interface"]:::ui
        AuthUI["Authentication UI"]:::ui
        PaymentUI["Payment UI"]:::ui
        OrderUI["Order Management UI"]:::ui
        FoodUI["Food Management UI"]:::ui
    end

    subgraph "State Management Layer"
        direction TB
        GoogleProvider["Google ID Provider"]:::provider
        PaymentProvider["Payment Provider"]:::provider
        RazorpayProvider["Razorpay Provider"]:::provider
    end

    subgraph "Service Layer"
        direction TB
        Firebase["Firebase Services"]:::external
        RazorpayGateway["Razorpay Gateway"]:::external
        AreaService["Area-based Services"]:::service
    end

    subgraph "Data Layer"
        direction TB
        OrderModel["Order Models"]:::model
        UserModel["User Models"]:::model
        FoodModel["Food Models"]:::model
        PaymentModel["Payment Models"]:::model
        AreaModel["Area Models"]:::model
    end

    %% Connections
    ConsumerUI --> GoogleProvider
    MerchantUI --> GoogleProvider
    AuthUI --> Firebase
    PaymentUI --> PaymentProvider
    PaymentUI --> RazorpayProvider
    OrderUI --> OrderModel
    FoodUI --> FoodModel

    GoogleProvider --> Firebase
    PaymentProvider --> RazorpayGateway
    RazorpayProvider --> RazorpayGateway

    Firebase --> UserModel
    Firebase --> OrderModel
    Firebase --> FoodModel
    RazorpayGateway --> PaymentModel
    AreaService --> AreaModel

    %% Click Events
    click ConsumerUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/screen/consumerScreen.dart"
    click MerchantUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/screen/merchantNavigationscreen.dart"
    click AuthUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/login.dart"
    click PaymentUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/screen/PaymentSuccessfulScreen.dart"
    click OrderUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/screen/myOrders.dart"
    click FoodUI "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/screen/foodDescription.dart"
    
    click GoogleProvider "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/providers/googleidProvider.dart"
    click PaymentProvider "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/providers/payment_provider.dart"
    click RazorpayProvider "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/providers/razorpay_update.dart"
    
    click Firebase "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/firebase_options.dart"
    click RazorpayGateway "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/razorpayService.dart"
    click AreaService "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/constants/area_names.dart"
    
    click OrderModel "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/models/ordersModel.dart"
    click UserModel "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/models/userDetails.dart"
    click FoodModel "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/models/foodDetails.dart"
    click PaymentModel "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/models/paymentFood.dart"
    click AreaModel "https://github.com/Syed-Abdullah-G/foodex/blob/main/lib/models/areaModel.dart"

    %% Styling
    classDef ui fill:#2196F3,stroke:#1976D2,color:white
    classDef provider fill:#4CAF50,stroke:#388E3C,color:white
    classDef external fill:#FF9800,stroke:#F57C00,color:white
    classDef model fill:#FFEB3B,stroke:#FDD835,color:black
    classDef service fill:#9C27B0,stroke:#7B1FA2,color:white

    %% Legend
    subgraph Legend
        UI[UI Components]:::ui
        Provider[State Management]:::provider
        External[External Services]:::external
        Model[Data Models]:::model
        Service[Internal Services]:::service
    end
```
