# yader1/flutter-food-ordering-app architecture

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

- Interactive diagram: https://gitdiagram.com/yader1/flutter-food-ordering-app
- Repository: https://github.com/yader1/flutter-food-ordering-app

## Overview

##### Project type and purpose
- This is a cross-platform full-stack mobile/desktop “Fast Food Shop” client built in Flutter.
- It uses GetX for state management & routing, communicates via REST to a Laravel backend, integrates Google Maps for address picking, Firebase (FCM) for notifications, and Laravel Echo for real-time events.

##### File structure
- Top-level platform folders (android, ios, web, linux, macos, windows) host native shells.
- The core app lives under /lib, organized into:
- base (shared widgets)
- controllers (GetX controllers driving UI state)
- data/api (ApiClient, API checker)
- data/repository (repository layer per feature)
- helper (DI setup, notifications)
- models (data transfer objects)
- pages & widgets (UI screens & components)
- routes (RouteHelper) and utils/constants.
- Dependencies declared in pubspec.yaml; firebase_options.dart & native google-services files show FCM.

##### README for insights
- Confirms GetX, GoogleMaps, Laravel Echo usage.
- Points to a separate Laravel REST backend.

a. Main components
- Client (Flutter App)
– UI Layer (Pages & Widgets)
– State/Logic Layer (GetX Controllers)
– Data Layer
· Repositories
· ApiClient (HTTP client + ApiChecker)
– Models & Helpers (DI, NotificationHelper)
- External Services
– REST API (Laravel backend + MySQL)
– Real-time channel (Laravel Echo / Pusher)
– Google Maps API
– Firebase Cloud Messaging
b. Relationships & interactions
- UI → Controller → Repository → ApiClient → Laravel REST API
- ApiClient ↔ Laravel Echo (WebSocket connection for live updates)
- Controller or Helper → Firebase FCM (push notifications)
- UI or Controller → Google Maps SDK (address picking)
c. Architectural patterns/design principles
- Layered architecture (UI → domain/controller → data → external)
- Repository pattern decouples controllers from HTTP calls
- Dependency injection in helper/dependencies.dart
- GetX for reactive state management & routing
d. Key technologies/frameworks
- Flutter & Dart
- GetX (state, DI, routing)
- http/GetConnect (ApiClient)
- GoogleMaps Flutter plugin
- firebase_messaging (FCM)
- Laravel Echo / Pusher for real-time
- Laravel REST API backend (external)

##### Detailed capture of essential elements
- Don’t omit the notification helper or DI setup—these are vital for FCM and controller instantiation.
- Firebase_options.dart linking native platforms to FCM.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Flutter Client"
    subgraph "UI Layer"
      Pages["Pages"]:::ui
      Widgets["Shared Widgets"]:::ui
      AddressPicker["PickAddressMap"]:::ui
    end
    subgraph "State/Logic Layer"
      Controllers["GetX Controllers"]:::controller
      RouteHelper["RouteHelper"]:::controller
    end
    subgraph "Data Layer"
      Repos["Repositories"]:::data
      ApiClient["ApiClient"]:::data
      ApiChecker["ApiChecker"]:::data
    end
    subgraph "Models & Helpers"
      Models["Models (DTOs)"]:::model
      DI["Dependencies (DI)"]:::model
      Notification["Notification Helper"]:::model
      FirebaseCfg["Firebase Config"]:::model
    end
    Entry["main.dart"]:::model
  end

  subgraph "Backend & Services"
    REST["Laravel REST API"]:::external
    MySQL["MySQL"]:::external
    Echo["Laravel Echo / Pusher"]:::external
    MapsAPI["Google Maps API"]:::external
    FCM["Firebase Cloud Messaging"]:::external
  end

  Entry --> Pages
  Entry --> Widgets
  Entry --> Controllers
  Pages --> Controllers
  Widgets --> Controllers
  Controllers --> Repos
  Controllers --> RouteHelper
  Repos --> ApiClient
  ApiClient --> ApiChecker
  ApiClient -->|HTTP| REST
  REST --> MySQL
  ApiClient <-->|WebSocket| Echo
  Controllers -->|push| FCM
  Notification -->|push| FCM
  Pages -->|SDK| MapsAPI
  Controllers -->|SDK| MapsAPI

  click Pages "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/pages/"
  click Widgets "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/widgets/"
  click Widgets "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/base/"
  click AddressPicker "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/pages/address/pick_address_map.dart"
  click RouteHelper "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/routes/route_helper.dart"
  click Controllers "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/controllers/"
  click ApiClient "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/data/api/api_client.dart"
  click ApiChecker "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/data/api/api_checker.dart"
  click Repos "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/data/repository/"
  click Models "https://github.com/yader1/flutter-food-ordering-app/tree/master/lib/models/"
  click DI "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/helper/dependencies.dart"
  click Notification "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/helper/notification_helper.dart"
  click FirebaseCfg "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/firebase_options.dart"
  click Entry "https://github.com/yader1/flutter-food-ordering-app/blob/master/lib/main.dart"

  classDef ui fill:#8ecae6,stroke:#023047,color:#023047
  classDef controller fill:#a8dadc,stroke:#1d3557,color:#1d3557
  classDef data fill:#ffb703,stroke:#fb8500,color:#fb8500
  classDef external fill:#b5179e,stroke:#7209b7,color:#ffffff
  classDef model fill:#adb5bd,stroke:#495057,color:#212529
```
