# kbm90/drivio architecture

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

- Interactive diagram: https://gitdiagram.com/kbm90/drivio
- Repository: https://github.com/kbm90/drivio

## Overview

##### Project Type and Purpose
- This is a cross-platform Flutter mobile application (“drivio”) implementing a ride-sharing service with two primary user roles: Drivers and Passengers.
- It leverages Flutter’s single codebase to produce Android and iOS clients (see `android/` and `ios/` folders), and implements modular Dart code under `lib/` for authentication, shared/common logic, driver-specific flows, and passenger-specific flows.

##### File Structure Analysis
- Top-level:
- `android/` and `ios/` – native build configurations and entry points for each platform.
- `lib/` – the entire Dart codebase, subdivided into:
– `auth/`: login & registration screens.
– `common/`: shared constants, helpers, models, providers (ChangeNotifiers), services (HTTP/REST clients), and widgets.
– `driver/`: driver-specific models, state providers, services (ride requests, notifications, map reports), UI screens, modals, and widgets.
– `passenger/`: passenger-specific screens, widgets, models.
– `main.dart`: app entry, routing, and high-level UI shell.
- Notice the use of the Provider pattern for state management (`lib/.../providers`) and a clear separation of concerns: UI → Providers (business logic) → Services (API calls) → Models (data).

##### Key Architectural Insights from the README
- The README is boilerplate but confirms this is a Flutter project and implies standard Flutter build/deploy workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Client (Flutter Engine)
    subgraph "Mobile Client (Flutter Engine)" 
        direction TB
        subgraph "Presentation Layer" 
            direction TB
            AuthLogin["LoginScreen"]:::presentation
            AuthRegister["RegisterScreen"]:::presentation
            CommonChat["ChatScreen"]:::presentation
            CommonInbox["InboxPage"]:::presentation
            CommonOpp["OpportunitiesPage"]:::presentation
            CommonRefer["ReferFriendsPage"]:::presentation
            CommonWidgets["Shared Widgets"]:::presentation
            DriverHome["DriverHomeScreen"]:::presentation
            DriverModals["Driver Modals"]:::presentation
            DriverScreens["Driver Screens"]:::presentation
            DriverWidgets["Driver Widgets"]:::presentation
            PassengerHome["HomeScreen"]:::presentation
            PassengerAccount["PassengerAccountScreen"]:::presentation
            PassengerActivity["PassengerActivityScreen"]:::presentation
            PassengerServices["PassengerServicesScreen"]:::presentation
            PassengerSearch["SearchBar & BottomNavBar"]:::presentation
        end

        subgraph "State Layer (Providers)"
            direction TB
            CommonProviders["Common Providers"]:::state
            DriverProviders["Driver Providers"]:::state
        end

        subgraph "Domain/Service Layer"
            direction TB
            CommonServices["Common Services"]:::service
            DriverServices["Driver Services"]:::service
        end

        subgraph "Data Layer (Models)"
            direction TB
            CommonModels["Common Models"]:::data
            DriverModels["Driver Models"]:::data
            PassengerModels["Passenger Models"]:::data
        end

        subgraph "Helpers & Plugins"
            direction TB
            SharedPrefs["SharedPreferencesHelper"]:::data
            Geolocator["GeolocatorHelper"]:::data
            OSRM["OSRM Services"]:::data
            CameraPlugin["CameraWidget"]:::data
        end
    end

    %% Platforms & Runtimes
    Android["Android Runtime\nMainActivity.kt"]:::external
    iOS["iOS Runtime\nAppDelegate.swift"]:::external

    %% External Services
    Backend["Backend REST API"]:::external
    GeolocationSvc["Geolocation Service / OSRM"]:::external
    PushNotif["Push Notification Service"]:::external
    MapTiles["Map Tile Provider"]:::external

    %% Data Flows
    AuthLogin -->|invokes| CommonProviders
    AuthRegister -->|invokes| CommonProviders
    CommonChat -->|invokes| CommonProviders
    CommonInbox -->|invokes| CommonProviders
    CommonOpp -->|invokes| CommonProviders
    CommonRefer -->|invokes| CommonProviders
    CommonWidgets -->|invokes| CommonProviders
    DriverHome -->|invokes| DriverProviders
    DriverModals -->|invokes| DriverProviders
    DriverScreens -->|invokes| DriverProviders
    DriverWidgets -->|invokes| DriverProviders
    PassengerHome -->|invokes| CommonProviders
    PassengerAccount -->|invokes| CommonProviders
    PassengerActivity -->|invokes| CommonProviders
    PassengerServices -->|invokes| CommonProviders
    PassengerSearch -->|invokes| CommonProviders

    CommonProviders -->|calls| CommonServices
    DriverProviders -->|calls| DriverServices
    CommonServices -->|HTTP| Backend
    DriverServices -->|HTTP| Backend
    Backend -->|JSON| CommonServices
    Backend -->|JSON| DriverServices
    CommonServices -->|deserialize| CommonModels
    DriverServices -->|deserialize| DriverModels

    Geolocator -->|coordinates| DriverProviders
    SharedPrefs -->|stores tokens| CommonProviders
    PushNotif -->|pushes events| DriverServices
    PushNotif -->|pushes events| CommonServices
    MapTiles -->|tiles| DriverServices

    Android -->|platform channel| Geolocator
    Android -->|platform channel| CameraPlugin
    iOS -->|platform channel| Geolocator
    iOS -->|platform channel| CameraPlugin

    %% Click Events
    click AuthLogin "https://github.com/kbm90/drivio/blob/main/lib/auth/login_screen.dart"
    click AuthRegister "https://github.com/kbm90/drivio/blob/main/lib/auth/register_screen.dart"
    click CommonChat "https://github.com/kbm90/drivio/blob/main/lib/common/screens/chat_screen.dart"
    click CommonInbox "https://github.com/kbm90/drivio/blob/main/lib/common/screens/inbox_page.dart"
    click CommonOpp "https://github.com/kbm90/drivio/blob/main/lib/common/screens/opportunities_page.dart"
    click CommonRefer "https://github.com/kbm90/drivio/blob/main/lib/common/screens/refer_friends_page.dart"
    click CommonWidgets "https://github.com/kbm90/drivio/tree/main/lib/common/widgets/"
    click DriverHome "https://github.com/kbm90/drivio/blob/main/lib/driver/ui/driver_home_screen.dart"
    click DriverModals "https://github.com/kbm90/drivio/tree/main/lib/driver/ui/modals/"
    click DriverScreens "https://github.com/kbm90/drivio/tree/main/lib/driver/ui/screens/"
    click DriverWidgets "https://github.com/kbm90/drivio/tree/main/lib/driver/ui/widgets/"
    click PassengerHome "https://github.com/kbm90/drivio/blob/main/lib/passenger/screens/home_screen.dart"
    click PassengerAccount "https://github.com/kbm90/drivio/blob/main/lib/passenger/screens/passenger_account_screen.dart"
    click PassengerActivity "https://github.com/kbm90/drivio/blob/main/lib/passenger/screens/passenger_activity_screen.dart"
    click PassengerServices "https://github.com/kbm90/drivio/blob/main/lib/passenger/screens/passenger_services_screen.dart"
    click PassengerSearch "https://github.com/kbm90/drivio/tree/main/lib/passenger/"
    click CommonProviders "https://github.com/kbm90/drivio/tree/main/lib/common/providers/"
    click DriverProviders "https://github.com/kbm90/drivio/tree/main/lib/driver/providers/"
    click CommonServices "https://github.com/kbm90/drivio/tree/main/lib/common/services/"
    click DriverServices "https://github.com/kbm90/drivio/tree/main/lib/driver/services/"
    click CommonModels "https://github.com/kbm90/drivio/tree/main/lib/common/models/"
    click DriverModels "https://github.com/kbm90/drivio/tree/main/lib/driver/models/"
    click PassengerModels "https://github.com/kbm90/drivio/tree/main/lib/passenger/models/"
    click SharedPrefs "https://github.com/kbm90/drivio/blob/main/lib/common/helpers/shared_preferences_helper.dart"
    click Geolocator "https://github.com/kbm90/drivio/blob/main/lib/common/helpers/geolocator_helper.dart"
    click OSRM "https://github.com/kbm90/drivio/blob/main/lib/common/helpers/osrm_services.dart"
    click CameraPlugin "https://github.com/kbm90/drivio/blob/main/lib/common/widgets/camera_widget.dart"
    click Android "https://github.com/kbm90/drivio/blob/main/android/app/src/main/kotlin/com/drivio/www/drivio/MainActivity.kt"
    click iOS "https://github.com/kbm90/drivio/blob/main/ios/Runner/AppDelegate.swift"

    %% Styles
    classDef presentation fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1
    classDef state fill:#C8E6C9,stroke:#1B5E20,color:#1B5E20
    classDef service fill:#FFE0B2,stroke:#E65100,color:#E65100
    classDef data fill:#ECEFF1,stroke:#37474F,color:#37474F
    classDef external fill:#FFCDD2,stroke:#B71C1C,color:#B71C1C
```
