# hi5sutex/service_provider architecture

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

- Interactive diagram: https://gitdiagram.com/hi5sutex/service_provider
- Repository: https://github.com/hi5sutex/service_provider

## Overview

##### Main Components
- Mobile Frontend – Represent the Flutter app at its center. This includes:
- Admin Panel: All screens and functionalities for administrators (analytics, dashboard, category & service management).
- Provider Panel: All screens for service providers (service management, earnings, live tracking, chat, booking details).
- User Panel: All screens intended for end users (booking, profile management, service details, search and list views).
- Shared Services and Utilities – These include common resources such as:
- Authentication and OTP services (lib/services/otp_service.dart and auth_provider.dart).
- Notification Services (lib/notification_service.dart).
- Utility Functions (location_service.dart, map_utils.dart and global configuration files).
- External Dependencies & Back-end Integrations:
- Firebase: As indicated by firebase.json, firebase_options.dart and google-services.json.
- Possibly third-party integrations (e.g., chat services, payment gateways if further explored).

##### Relationships and Interaction Flow
- The Flutter Application (lib/main.dart) acts as the entry point that directs user flow based on role using routing and navigation.
- Each panel (Admin, Provider, User) functions as a self-contained module, but they may share common services for cross-platform tasks (authentication, OTP verification, notifications).
- Mobile UI components interact with Firebase and any external APIs for data storage, real-time notifications, and analytics.
- The communications within the screens (e.g., chat functionality in both Provider Panel and User Panel) should be modeled to show two-way interactions.

##### Architectural Patterns and Design Principles
- Modular Organization – The file tree’s segregation by roles indicates a modular design where each user type is developed as an independent module within the same Flutter project.
- Clear Separation of Concerns – UI (in each panel’s screens) is separated from service logic (in lib/services, lib/utils, etc.).
- Reusability – Common functionalities (like CustomSnackBar and global configurations) are shared across modules.
- Integration with third-party services (Firebase) hints at leveraging cloud capabilities for back-end services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Central Entry Point
    FM("Flutter Mobile App (Main Entry Point)"):::frontend

    %% Panels Subgraph
    subgraph "Panels"
        AP("Admin Panel – Manage Services, Analytics, Dashboard"):::frontend
        PP("Provider Panel – Service Management, Earnings, Live Tracking, Chat"):::frontend
        UP("User Panel – Booking, Profile, Service Details"):::frontend
    end

    %% Shared Services & Utilities Subgraph
    subgraph "Shared Services & Utilities"
        AOTP("Authentication & OTP Services"):::service
        NS("Notification Service"):::service
        UF("Utility Functions (Location & Map Utils)"):::service
    end

    %% External Integration
    FI("Firebase Integration"):::external

    %% Interaction Flows
    FM -->|"routesTo"| AP
    FM -->|"routesTo"| PP
    FM -->|"routesTo"| UP

    AP -->|"uses"| AOTP
    AP -->|"uses"| NS
    AP -->|"uses"| UF

    PP -->|"uses"| AOTP
    PP -->|"uses"| NS
    PP -->|"uses"| UF

    UP -->|"uses"| AOTP
    UP -->|"uses"| NS
    UP -->|"uses"| UF

    %% Chat functionality between Provider and User Panels
    PP <-->|"chatFlow"| UP

    %% Shared Services linking to Firebase Integration
    AOTP -->|"integrates"| FI
    NS -->|"sendsNotificationsTo"| FI
    UF -->|"usesMapDataFrom"| FI

    %% Direct panel interactions with Firebase Integration
    AP -->|"analyticsData"| FI
    PP -->|"realtimeData"| FI
    UP -->|"userData"| FI

    %% Architectural Note
    Note["Note: ModularDesign&SeparationOfConcerns"]:::external
    FI --- Note

    %% Click Events
    click FM "https://github.com/hi5sutex/service_provider/blob/master/lib/main.dart"
    click AP "https://github.com/hi5sutex/service_provider/tree/master/lib/Admin Panel/"
    click PP "https://github.com/hi5sutex/service_provider/tree/master/lib/Provider Panel/"
    click UP "https://github.com/hi5sutex/service_provider/tree/master/lib/User Panel/"
    click AOTP "https://github.com/hi5sutex/service_provider/blob/master/lib/auth_provider.dart"
    click AOTP "https://github.com/hi5sutex/service_provider/blob/master/lib/services/otp_service.dart"
    click NS "https://github.com/hi5sutex/service_provider/blob/master/lib/notification_service.dart"
    click UF "https://github.com/hi5sutex/service_provider/blob/master/lib/utils/location_service.dart"
    click UF "https://github.com/hi5sutex/service_provider/blob/master/lib/utils/map_utils.dart"
    click FI "https://github.com/hi5sutex/service_provider/blob/master/firebase.json"
    click FI "https://github.com/hi5sutex/service_provider/blob/master/lib/firebase_options.dart"
    click FI "https://github.com/hi5sutex/service_provider/blob/master/android/app/google-services.json"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef service fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
```
