# marioibrahem1/pro-dlm architecture

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

- Interactive diagram: https://gitdiagram.com/marioibrahem1/pro-dlm
- Repository: https://github.com/marioibrahem1/pro-dlm

## Overview

##### Project type and purpose
- Full-stack mobile (and desktop/web) client application built in Flutter
- Purpose: assist users on the road—chat with AI, request help, show maps/places, send notifications, collect ratings
- No standalone backend code is included; the app consumes external APIs and services

##### High-level architectural components
a. Platform targets (Android, iOS, Web, Windows)
b. Flutter engine & framework
c. Application code (Dart):
‑ UI layer (lib/ui)
‑ State/Domain layer (lib/providers, lib/models)
‑ Data/Infrastructure layer (lib/services)
‑ Utility helpers (lib/utils)
d. Assets & configurations (assets/, pubspec.yaml)
e. External systems:
‑ Chat AI (Gemini/OpenAI)
‑ Help-request backend API
‑ Places API (Google Maps/Places)
‑ Notification services (local & push)

##### Relationships and interactions
- At runtime, the user interacts with UI screens/widgets.
- UI widgets dispatch actions to Providers (state managers).
- Providers call Services to fetch/push data.
- Services perform HTTP calls over REST/gRPC to external systems (chat AI, maps, help-request server, profile server).
- Data flows back through Services → Providers → UI.
- Utility modules support cross-cutting concerns (theme, animations, location).
- Platform channels handle OS integrations (notifications, local storage, maps renderer).

##### Important architectural patterns & design principles
- Layered architecture (Presentation → Domain → Data)
- Provider for state-management (dependency injection)
- Service abstractions for all external calls (single responsibility)
- MVC/MVVM-like separation: Widgets (View) ← Providers (ViewModel) ← Services (Model/Data)
- Cross-platform code sharing via Flutter engine

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform Targets Layer
    subgraph "Platform Targets"
        direction TB
        android["Android"]:::platform
        ios["iOS"]:::platform
        web["Web"]:::platform
        windows["Windows"]:::platform
    end
    %% Flutter Engine & Framework
    FlutterEngine["Flutter Engine & Framework"]:::platform

    android --> FlutterEngine
    ios --> FlutterEngine
    web --> FlutterEngine
    windows --> FlutterEngine

    %% UI Module
    subgraph "UI Module" 
        direction TB
        UIScreens["Screens (lib/ui/screens/)"]:::frontend
        UIWidgets["Widgets (lib/ui/widgets/)"]:::frontend
    end

    FlutterEngine --> UIScreens
    FlutterEngine --> UIWidgets

    %% State/Domain Module
    subgraph "State/Domain Module"
        direction TB
        Providers["Providers (lib/providers/)"]:::domain
        Models["Models (lib/models/)"]:::domain
    end

    UIScreens -->|dispatch actions| Providers
    UIWidgets -->|dispatch actions| Providers

    Providers --> Models

    %% Data/Service Module
    subgraph "Data/Service Module"
        direction TB
        APIService["api_service.dart"]:::data
        ChatService["chat_service.dart"]:::data
        GeminiService["gemini_service.dart"]:::data
        HelpRequestService["help_request_service.dart"]:::data
        PlacesService["places_service.dart"]:::data
        NotificationService["notification_service.dart"]:::data
        LocalNotificationService["local_notification_service.dart"]:::data
        ProfileService["profile_service.dart"]:::data
    end

    Providers -->|calls services| APIService
    Providers --> ChatService
    Providers --> GeminiService
    Providers --> HelpRequestService
    Providers --> PlacesService
    Providers --> NotificationService
    Providers --> LocalNotificationService
    Providers --> ProfileService

    %% Utilities Module
    Utils["Utilities (lib/utils/)"]:::util
    Utils -.-> UIScreens
    Utils -.-> Providers
    Utils -.-> APIService

    %% Assets & Configurations
    Assets["Assets & Configurations"]:::util
    Assets --> UIScreens
    Assets --> UIWidgets

    %% External Services
    subgraph "External Services"
        direction TB
        ChatAI((Chat AI API)):::external
        HelpAPI((Help Request API)):::external
        PlacesAPI((Places API)):::external
        PushNotif((Push Notification Service)):::external
        LocalNotif((Local Notification)):::external
    end

    APIService -->|HTTP| ChatAI
    ChatService -->|chat calls| ChatAI
    GeminiService -->|AI calls| ChatAI
    HelpRequestService -->|POST /help-request| HelpAPI
    PlacesService -->|GET places| PlacesAPI
    NotificationService -->|push| PushNotif
    LocalNotificationService -->|local| LocalNotif

    %% Data returns
    ChatAI -->|response| ChatService
    HelpAPI -->|response| HelpRequestService
    PlacesAPI -->|response| PlacesService
    PushNotif -->|ack| NotificationService
    LocalNotif -->|ack| LocalNotificationService

    %% Click Events
    click android "https://github.com/marioibrahem1/pro-dlm/tree/main/android/"
    click ios "https://github.com/marioibrahem1/pro-dlm/tree/main/ios/"
    click web "https://github.com/marioibrahem1/pro-dlm/tree/main/web/"
    click windows "https://github.com/marioibrahem1/pro-dlm/tree/main/windows/"
    click UIScreens "https://github.com/marioibrahem1/pro-dlm/tree/main/lib/ui/screens/"
    click UIWidgets "https://github.com/marioibrahem1/pro-dlm/tree/main/lib/ui/widgets/"
    click Providers "https://github.com/marioibrahem1/pro-dlm/tree/main/lib/providers/"
    click Models "https://github.com/marioibrahem1/pro-dlm/tree/main/lib/models/"
    click APIService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/api_service.dart"
    click ChatService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/chat_service.dart"
    click GeminiService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/gemini_service.dart"
    click HelpRequestService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/help_request_service.dart"
    click PlacesService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/places_service.dart"
    click NotificationService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/notification_service.dart"
    click LocalNotificationService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/local_notification_service.dart"
    click ProfileService "https://github.com/marioibrahem1/pro-dlm/blob/main/lib/services/profile_service.dart"
    click Utils "https://github.com/marioibrahem1/pro-dlm/tree/main/lib/utils/"
    click Assets "https://github.com/marioibrahem1/pro-dlm/tree/main/assets/"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#0D47A1,color:#0D47A1
    classDef domain fill:#E8F5E9,stroke:#1B5E20,color:#1B5E20
    classDef data fill:#FFF3E0,stroke:#E65100,color:#E65100
    classDef util fill:#F5F5F5,stroke:#757575,color:#424242
    classDef platform fill:#ECEFF1,stroke:#263238,color:#263238
    classDef external fill:#FFEBEE,stroke:#B71C1C,color:#B71C1C,stroke-dasharray: 5 5
```
