# ashwinbicholiya/food-delivery-app architecture

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

- Interactive diagram: https://gitdiagram.com/ashwinbicholiya/food-delivery-app
- Repository: https://github.com/ashwinbicholiya/food-delivery-app

## Overview

##### Project type and purpose
- This is a Flutter-based cross-platform mobile application for food delivery.
- The README confirms it’s a user-facing app demonstrating menu browsing, cart management, ordering, payment, and profile features.
- There is no custom backend code here; instead it relies on external services (e.g., Firebase via google-services.json).

##### File structure
- Top-level directories:
– android, ios: native platform code and build configurations
– lib: Dart source organized by feature (Restaurant, loginpage, paymentpage, location) plus shared modules (bloc, services, model, widgets, const)
– assets: fonts
– test: automated widget tests
- The lib folder uses the BLoC (Business Logic Component) pattern:
– lib/bloc holds blocs and provider
– lib/services encapsulates CRUD operations, user management, restaurant management
– lib/model defines data structures (fooditem)
– lib/widgets holds reusable UI components
- Configuration: pubspec.yaml for dependencies; google-services.json suggests Firebase integration; AndroidManifest and Info.plist for platform permissions.

##### README for additional insights
- Describes features (screenshots of menus, login, checkout)
- Points at Flutter ecosystem documentation

a. Main components
1. Mobile Client (Flutter app)
- UI Layer: Screens (firstpage, cart, payment, map)
- BLoC Layer: cartListBloc, listTileColorBloc, provider
- Service Layer: usermanagement, restmanagement, crud (wraps Firebase/REST calls)
- Data Model: fooditem, user, cart items
2. External Services
- Firebase Auth / Firestore / Realtime Database (from google-services.json)
- Payment gateway SDK (in paymentpage/debit_card.dart)
- Service (in location/map.dart)
3. Platform SDKs
- Android and iOS host apps and permissions
b. Relationships and interactions
- UI components dispatch events to BLoCs
- BLoCs call Service Layer methods
- Services interact with Firebase or payment SDKs
- Data flows back through BLoC streams to UI widgets
- View consumes location services via platform channels or plugins
c. Architectural patterns and principles
- Separation of concerns via layered architecture: UI, state (BLoC), data services, models
- Reactive data flow with Streams/Sinks in BLoC
- Dependency injection via custom provider class
- Feature-based modularization in lib (each screen group in its own folder)
d. Key technologies and frameworks
- Flutter (Dart) for UI
- BLoC pattern for state management
- Firebase SDKs for backend services
- Third-party packages (map, payment processing)

– Rectangles (blue) for on-device components: UI, BLoC, Services, Models
– UI → BLoC → Services → External Services → Services → BLoC → UI
– Map UI → Map plugin → Map Service

##### Detail
- Every major screen or feature module (e.g., LoginPage, RestaurantList, CartPage, PaymentPage, ProfilePage).
- Provider class as the glue for BLoC dependencies.
- Fonts/assets bundle being loaded at app startup.
- How Android and iOS manifests grant permissions (location, internet).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Flutter App Container
    subgraph "Flutter App"
        direction TB

        %% Assets
        Assets["Fonts: Quicksand"]:::assets
        Assets -->|loads at startup| UI

        %% Constants
        ThemeConst["Theme Colors"]:::const

        %% Shared Widgets
        ProfileTile["Profile Tile Widget"]:::widgets

        %% Data Model
        FoodItem["FoodItem Model"]:::model

        %% Service Layer
        subgraph "Service Layer"
            direction TB
            CRUD["CRUD Operations"]:::service
            RestService["Restaurant Management"]:::service
            UserService["User Management"]:::service
        end

        %% BLoC Layer
        subgraph "BLoC Layer"
            direction TB
            CartBloc["CartListBloc"]:::bloc
            ColorBloc["ListTileColorBloc"]:::bloc
            Provider["Provider"]:::bloc
        end

        %% UI Layer
        subgraph "UI Layer"
            direction TB
            MainApp["Main (lib/main.dart)"]:::ui
            FirstPage["FirstPage"]:::ui
            CartPage["CartPage"]:::ui
            RestHome["Restaurant Home"]:::ui
            RLogin["Restaurant Login"]:::ui
            RSignup["Restaurant Signup"]:::ui
            SignIn["User Sign-In"]:::ui
            SignUp["User Sign-Up"]:::ui
            ProfilePage["User Profile"]:::ui
            PaymentPage["Payment Page"]:::ui
            DebitCard["Debit Card Entry"]:::ui
            PaySuccess["Payment Success"]:::ui
            MapView["Map View"]:::ui
        end

        %% Relationships
        UI["UI Components"]:::ui
        UI -->|dispatch events| CartBloc
        UI -->|dispatch events| ColorBloc
        UI -->|uses| Provider
        CartBloc -->|calls| CRUD
        CartBloc -->|calls| RestService
        CartBloc -->|calls| UserService
        ColorBloc -->|calls| CRUD
        Provider -->|injects| CartBloc
        Provider -->|injects| ColorBloc
        Provider -->|injects| Services

        CRUD -->|interacts with| Firebase
        RestService -->|interacts with| Firebase
        UserService -->|interacts with| Firebase

        MapView -->|uses plugin| MapService
        PaymentPage -->|uses SDK| PaymentService
    end

    %% External Services
    Firebase["Firebase (Auth/Firestore)"]:::external
    PaymentService["Payment Gateway SDK"]:::external
    MapService["Map Service SDK"]:::external

    %% Platform Host
    subgraph "Platform Host"
        direction TB
        Android["Android"]:::platform
        iOS["iOS"]:::platform
    end

    Android -->|hosts| FlutterApp["Flutter App"]
    iOS -->|hosts| FlutterApp

    %% Click Events
    click MainApp "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/main.dart"
    click FirstPage "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/firstpage.dart"
    click CartPage "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/cart.dart"
    click RestHome "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/Restaurant/resthome.dart"
    click RLogin "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/Restaurant/rlogin.dart"
    click RSignup "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/Restaurant/rsignup.dart"
    click SignIn "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/loginpage/sigin_page.dart"
    click SignUp "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/loginpage/signup_page.dart"
    click ProfilePage "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/loginpage/profile.dart"
    click PaymentPage "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/paymentpage/payment_page.dart"
    click DebitCard "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/paymentpage/debit_card.dart"
    click PaySuccess "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/paymentpage/payment_success.dart"
    click MapView "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/location/map.dart"
    click CartBloc "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/bloc/cartListBloc.dart"
    click ColorBloc "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/bloc/listTileColorBloc.dart"
    click Provider "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/bloc/provider.dart"
    click CRUD "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/services/crud.dart"
    click RestService "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/services/restmanagement.dart"
    click UserService "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/services/usermanagement.dart"
    click FoodItem "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/model/fooditem.dart"
    click ProfileTile "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/widgets/profile_tile.dart"
    click ThemeConst "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/lib/const/themeColor.dart"
    click Assets "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/assets/fonts/Quicksand_Bold.otf"
    click Android "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/android/app/src/main/kotlin/com/example/food_delivery/MainActivity.kt"
    click AndroidConfig "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/android/app/google-services.json"
    click AndroidManifest "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/android/app/src/main/AndroidManifest.xml"
    click iOS "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/ios/Runner/AppDelegate.swift"
    click iOSConfig "https://github.com/ashwinbicholiya/food-delivery-app/blob/master/ios/Runner/Info.plist"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#3B82F6
    classDef bloc fill:#E0F2FE,stroke:#0284C7
    classDef service fill:#FEF9C3,stroke:#EAB308
    classDef model fill:#DCFCE7,stroke:#059669
    classDef widgets fill:#FCE7F3,stroke:#DB2777
    classDef const fill:#EDE9FE,stroke:#7C3AED
    classDef assets fill:#FDE68A,stroke:#CA8A04
    classDef external fill:#D1FAE5,stroke:#10B981
    classDef platform fill:#FEE2E2,stroke:#DC2626
```
