# ismailq62/graduation-project architecture

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

- Interactive diagram: https://gitdiagram.com/ismailq62/graduation-project
- Repository: https://github.com/ismailq62/graduation-project

## Overview

##### Project type and purpose
- This is a cross-platform Flutter “lorescue” mobile/desktop/web application (graduation-project) for emergency-rescue coordination.
- The app supports Android, iOS, Linux, macOS, Windows and Web, provides user/admin/responder workflows, real-time chat/SOS, channel management, notifications, mapping/GPS, and interfaces with ESP32/LoRa devices.

##### File structure
- Top-level “android”, “ios”, “linux”, “macos”, “windows”, “web” directories: platform integration layers generated by Flutter.
- “lib/” contains all Dart code, subdivided into:
- controllers/ – notification_controller.dart
- models/ – domain objects: user, admin, responder, channel, message, zone, individual
- services/ – abstraction for Auth, Database (channel_service, message_service, user_service), ESP32 HTTP, ESP32 over sockets, GPS, LoRa, JSON encoding
- views/ – UI screens organized by role (admin, responder) and feature (chat, map, login, register, SOS)
- widgets/ – reusable UI components
- “test/” directory holds unit tests for message_service and user_service.
- Configuration files: pubspec.yaml, analysis_options.yaml, build.gradle.kts, CMakeLists.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        EntryPoint["EntryPoint (lib/main.dart)"]:::presentation
        Routes["Routing Config (lib/routes.dart)"]:::presentation
        Views["Views (lib/views/)"]:::presentation
        Widgets["Widgets (lib/widgets/)"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        NotificationController["NotificationController (notification_controller.dart)"]:::logic
    end

    %% Data & Infrastructure Layer
    subgraph "Data/Infrastructure Layer"
        direction TB
        AuthService["AuthService"]:::data
        DatabaseService["DatabaseService"]:::data
        ChannelService["ChannelService"]:::data
        MessageService["MessageService"]:::data
        UserService["UserService"]:::data
        Esp32HttpService["Esp32HttpService"]:::data
        Esp32SocketService["Esp32SocketService"]:::data
        LoraService["LoraService"]:::data
        GpsService["GpsService"]:::data
        JsonHelpers["JSON Helpers"]:::data
        subgraph "Domain Models"
            direction TB
            UserModel["UserModel"]:::data
            AdminModel["AdminModel"]:::data
            ResponderModel["ResponderModel"]:::data
            ChannelModel["ChannelModel"]:::data
            MessageModel["MessageModel"]:::data
            ZoneModel["ZoneModel"]:::data
            IndividualModel["IndividualModel"]:::data
        end
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        RemoteDB["Remote Database"]:::external
        AuthServer["Authentication Server"]:::external
        PushNotif["Push Notification Service"]:::external
        MapAPI["Mapping API"]:::external
        IoTDevices["IoT Devices"]:::external
        subgraph "IoT Devices"
            direction TB
            ESP32_HTTP["ESP32 (HTTP)"]:::external
            ESP32_Socket["ESP32 (Socket)"]:::external
            LoRaNet["LoRa Network"]:::external
            GPSModule["GPS Module"]:::external
        end
    end

    %% Platform Targets
    subgraph "Platform Integrations"
        direction TB
        AndroidPlatform["Android"]:::platform
        iOSPlatform["iOS"]:::platform
        LinuxPlatform["Linux"]:::platform
        MacOSPlatform["macOS"]:::platform
        WindowsPlatform["Windows"]:::platform
        WebPlatform["Web"]:::platform
    end

    %% Unit Tests
    subgraph "Unit Tests"
        direction TB
        MessagesServiceTest["message_service Test"]:::test
        UserServiceTest["user_service Test"]:::test
    end

    %% Connections
    EntryPoint -->|initializes| Routes
    EntryPoint -->|loads| Views
    EntryPoint -->|loads| Widgets
    Views -->|user actions| NotificationController
    Routes -->|navigation events| NotificationController

    NotificationController -->|calls| AuthService
    NotificationController -->|calls| DatabaseService
    NotificationController -->|calls| ChannelService
    NotificationController -->|calls| MessageService
    NotificationController -->|calls| UserService
    NotificationController -->|uses| Esp32HttpService
    NotificationController -->|uses| Esp32SocketService
    NotificationController -->|uses| LoraService
    NotificationController -->|uses| GpsService

    AuthService -->|HTTP| AuthServer
    DatabaseService -->|CRUD| RemoteDB
    ChannelService -->|HTTP POST /channels| RemoteDB
    MessageService -->|HTTP GET /messages| RemoteDB
    UserService -->|HTTP GET /users| RemoteDB
    Esp32HttpService -->|HTTP| ESP32_HTTP
    Esp32SocketService -->|Socket| ESP32_Socket
    LoraService -->|Radio| LoRaNet
    GpsService -->|NMEA| GPSModule
    NotificationController -->|push events| PushNotif
    Views -->|map render| MapAPI

    %% Services use Models
    AuthService --> UserModel
    ChannelService --> ChannelModel
    MessageService --> MessageModel
    UserService --> UserModel
    NotificationController --> ZoneModel
    NotificationController --> IndividualModel
    JsonHelpers --> MessageModel

    %% Tests
    MessagesServiceTest -->|tests| MessageService
    UserServiceTest -->|tests| UserService

    %% Platform links
    EntryPoint --> AndroidPlatform
    EntryPoint --> iOSPlatform
    EntryPoint --> LinuxPlatform
    EntryPoint --> MacOSPlatform
    EntryPoint --> WindowsPlatform
    EntryPoint --> WebPlatform

    %% Click Events
    click EntryPoint "https://github.com/ismailq62/graduation-project/blob/main/lib/main.dart"
    click Routes "https://github.com/ismailq62/graduation-project/blob/main/lib/routes.dart"
    click Views "https://github.com/ismailq62/graduation-project/tree/main/lib/views/"
    click Widgets "https://github.com/ismailq62/graduation-project/tree/main/lib/widgets/"
    click NotificationController "https://github.com/ismailq62/graduation-project/blob/main/lib/controllers/notification_controller.dart"
    click UserModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/user_model.dart"
    click AdminModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/admin_model.dart"
    click ResponderModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/responder_model.dart"
    click ChannelModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/channel_model.dart"
    click MessageModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/message_model.dart"
    click ZoneModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/zone_model.dart"
    click IndividualModel "https://github.com/ismailq62/graduation-project/blob/main/lib/models/individual_model.dart"
    click AuthService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/auth_service.dart"
    click DatabaseService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/database/database_service.dart"
    click ChannelService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/database/channel_service.dart"
    click MessageService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/database/message_service.dart"
    click UserService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/database/user_service.dart"
    click Esp32HttpService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/esp32_http_service.dart"
    click Esp32SocketService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/esp32_service.dart"
    click LoraService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/lora_service.dart"
    click GpsService "https://github.com/ismailq62/graduation-project/blob/main/lib/services/gps_service.dart"
    click JsonHelpers "https://github.com/ismailq62/graduation-project/blob/main/lib/services/json/message_json.dart"
    click MessagesServiceTest "https://github.com/ismailq62/graduation-project/blob/main/test/messages_service_test.dart"
    click UserServiceTest "https://github.com/ismailq62/graduation-project/blob/main/test/user_service_test.dart"
    click AndroidPlatform "https://github.com/ismailq62/graduation-project/tree/main/android/"
    click iOSPlatform "https://github.com/ismailq62/graduation-project/tree/main/ios/"
    click LinuxPlatform "https://github.com/ismailq62/graduation-project/tree/main/linux/"
    click MacOSPlatform "https://github.com/ismailq62/graduation-project/tree/main/macos/"
    click WindowsPlatform "https://github.com/ismailq62/graduation-project/tree/main/windows/"
    click WebPlatform "https://github.com/ismailq62/graduation-project/tree/main/web/"

    %% Styles
    classDef presentation fill:#D4E6F1,stroke:#1B4F72,stroke-width:1px
    classDef logic fill:#D5F5E3,stroke:#1D8348,stroke-width:1px
    classDef data fill:#FAD7A0,stroke:#B9770E,stroke-width:1px
    classDef external fill:#E5E7E9,stroke:#566573,stroke-width:1px
    classDef platform fill:#EBDEF0,stroke:#7D3C98,stroke-width:1px
    classDef test fill:#F5B7B1,stroke:#943126,stroke-width:1px
```
