# ashok-a15/go_laari architecture

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

- Interactive diagram: https://gitdiagram.com/ashok-a15/go_laari
- Repository: https://github.com/ashok-a15/go_laari

## Overview

1. **Workspace shape**
   - This repo is not a single app; it is a **two-app Flutter workspace** for the Go Laari logistics platform.
   - The two independent client apps are:
     - **Customer app**: `golorry_customer_app-master`
     - **Owner/driver app**: `golorry_owner_driver_app_master`
   - They are built, tested, and deployed separately, but share the same product domain: bookings, location tracking, and Firebase-backed state.

2. **Customer app: primary user-facing flow**
   - The customer app is the booking and trip-following client.
   - Its main screens cover the lifecycle from onboarding/authentication to booking, fare estimation, live tracking, and trip history/settings.
   - Key UI areas include `auth`, `booking_summary`, `estimate`, `live_tracking`, `map`, `tracking`, `profile`, and several settings pages.

3. **Customer app: presentation-to-service boundary**
   - The Flutter UI is split from logic-heavy services in `lib/services`.
   - Core service responsibilities include:
     - authentication
     - booking creation and retrieval
     - directions and geocoding
     - driver tracking and map camera control
     - user/profile access
   - A `tracking_provider` suggests state is propagated through provider-style reactive state management.

4. **Customer app: mapping and trip computation**
   - The customer side contains a dedicated mapping subsystem:
     - route/direction handling
     - map styling and constants
     - marker generation
     - fare calculation
     - location interpolation for smoother movement
   - This is the part of the app that turns location and booking data into a route visualization and trip progress experience.

5. **Customer app: backend/data dependencies**
   - The customer app is wired to **Firebase** through Android config and Firestore rules/indexes.
   - The presence of `google-services.json`, `firestore.rules`, and `firestore.indexes.json` indicates Firestore is a central persistence layer.
   - The app also includes platform shells for Android, iOS, web, macOS, Windows, and Linux, so Flutter is the main runtime with native wrappers only for embedding/configuration.

6. **Customer app: separate Python backend**
   - The `backend/` folder is a distinct service from the Flutter client.
   - It contains:
     - `main.py`
     - `train_model.py`
     - `intents.json`
     - `intent_model.pkl`
     - `serviceAccountKey.json`
   - This strongly suggests a **Python-based NLP/chatbot backend** that is trained from intents and likely uses Firebase/admin credentials for integration with the app.

7. **Owner/driver app: primary operational flow**
   - The owner/driver app is the operational side of the platform.
   - Its UI is organized around:
     - role selection and login
     - dashboard and main shell
     - driver management
     - available jobs/bookings
     - live tracking
     - earnings and profile/settings pages
   - The structure indicates this app is meant for job acceptance, trip execution, and account/driver operations rather than customer booking.

8. **Owner/driver app: real-time operations layer**
   - The service layer includes:
     - authentication
     - Firestore access
     - geocoding
     - tracking
     - background service support
   - `background_service.dart` is a key architectural clue: the app likely continues publishing location or tracking updates even when not foregrounded.
   - `tracking_service.dart` and `owner_map.dart` indicate it is responsible for feeding live driver position data into the system.

9. **Shared platform pattern between the two apps**
   - Both apps appear to use a **Firebase-centered architecture** for identity and shared state.
   - The customer app consumes trip/driver location state; the owner/driver app produces that state.
   - In other words, the platform likely uses Firestore as the coordination layer between booking requests, job acceptance, and live tracking updates, with Flutter UI on both sides and Firebase as the shared backend.

10. **Ancillary web/login assets**
   - Both repos contain `assets/lamp_login/` with HTML/CSS/JS.
   - This looks like an embedded or auxiliary login/landing asset bundle rather than the primary app shell.
   - The exact integration point is not visible, but it is part of the app packaging rather than a separate service.

11. **Build, delivery, and automation**
   - The repositories include CI/CD workflows and mobile build configuration:
     - customer app: GitHub Actions and Codemagic, plus a Firebase distribution workflow
     - owner app: GitHub Actions CI/CD and `firebase.json`
   - This means the deployment pipeline is split from runtime concerns and likely targets Firebase distribution/hosting or app release automation.

12. **Architecture diagram takeaway**
   - A useful diagram should show **two Flutter clients** at the edges:
     - Customer app: booking, estimation, trip monitoring
     - Owner/driver app: job handling, tracking, trip execution
   - Between them sits **Firebase/Firestore** as the shared coordination plane.
   - The customer app also has a **Python chatbot/NLP backend**, while the owner app has a **separate Node/Firebase-oriented backend entrypoint**.
   - Mapping, routing, and geocoding are cross-cutting concerns in both apps and are central to the trip/tracking experience.

Main entry points: [`golorry_customer_app-master/lib/screens`](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/screens) (Customer UI), [`golorry_owner_driver_app_master/lib/services`](https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/services) (Owner Services), [`golorry_customer_app-master/lib/services`](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/services) (Customer Services), [`golorry_owner_driver_app_master/lib/pages`](https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/pages) (Owner UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer_app["Customer App"]
  node_customer_main(("Customer Shell<br/>Flutter entrypoint<br/>[main.dart]"))
  node_customer_ui["Customer UI<br/>Screens"]
  node_customer_services["Customer Services<br/>Service layer"]
  node_customer_map_utils["Map Logic<br/>Trip mapping"]
  node_customer_state["Tracking State<br/>Provider state"]
  node_customer_backend_entry(("Chatbot API<br/>Python backend<br/>[main.py]"))
  node_customer_backend_train["Model Train<br/>NLP pipeline<br/>[train_model.py]"]
  node_customer_backend_data["Intent Data<br/>NLP assets<br/>[intents.json]"]
end

subgraph group_owner_app["Owner/Driver App"]
  node_owner_main(("Owner Shell<br/>Flutter entrypoint<br/>[main.dart]"))
  node_owner_ui["Owner UI<br/>Pages"]
  node_owner_services["Owner Services<br/>Service layer"]
  node_owner_map["Owner Map<br/>Live map<br/>[owner_map.dart]"]
  node_owner_background(("Background Sync<br/>Runtime service"))
  node_owner_firestore["Firestore Bridge<br/>Shared state access"]
end

subgraph group_shared_platform["Shared Platform"]
  node_customer_firebase_cfg["Firestore Config<br/>Firebase config<br/>[firestore.rules]"]
  node_customer_assets["Login Assets<br/>Web asset bundle"]
  node_owner_backend(("Backend Entry<br/>Node backend<br/>[index.js]"))
  node_delivery_ci_customer["Customer CI/CD<br/>Build pipeline<br/>[flutter_build.yml]"]
  node_delivery_ci_owner["Owner CI/CD<br/>Build pipeline<br/>[ci.yml]"]
end

node_customer_main -->|"boots"| node_customer_ui
node_customer_ui -->|"uses"| node_customer_services
node_customer_ui -->|"subscribes"| node_customer_state
node_customer_services -->|"computes"| node_customer_map_utils
node_customer_services -->|"reads/writes"| node_customer_firebase_cfg
node_customer_state -->|"syncs"| node_customer_firebase_cfg
node_customer_main -->|"integrates"| node_customer_backend_entry
node_customer_backend_entry -->|"loads model"| node_customer_backend_train
node_customer_backend_train -->|"trains from"| node_customer_backend_data
node_customer_ui -.->|"embeds"| node_customer_assets
node_owner_main -->|"boots"| node_owner_ui
node_owner_ui -->|"uses"| node_owner_services
node_owner_ui -->|"renders"| node_owner_map
node_owner_services -->|"starts"| node_owner_background
node_owner_services -->|"reads/writes"| node_owner_firestore
node_owner_services -->|"feeds"| node_owner_map
node_owner_firestore -->|"coordinates with"| node_owner_backend
node_customer_firebase_cfg -->|"shared plane"| node_owner_firestore
node_delivery_ci_customer -.->|"builds"| node_customer_main
node_delivery_ci_owner -.->|"builds"| node_owner_main

click node_customer_main "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/lib/main.dart"
click node_customer_ui "https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/screens"
click node_customer_services "https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/services"
click node_customer_map_utils "https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/utils"
click node_customer_state "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/lib/providers/tracking_provider.dart"
click node_customer_backend_entry "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/main.py"
click node_customer_backend_train "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/train_model.py"
click node_customer_backend_data "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/intents.json"
click node_customer_firebase_cfg "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/firestore.rules"
click node_customer_assets "https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/assets/lamp_login"
click node_owner_main "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/main.dart"
click node_owner_ui "https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/pages"
click node_owner_services "https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/services"
click node_owner_map "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/widgets/owner_map.dart"
click node_owner_background "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/services/background_service.dart"
click node_owner_firestore "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/services/firestore_service.dart"
click node_owner_backend "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/backend/index.js"
click node_delivery_ci_customer "https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/.github/workflows/flutter_build.yml"
click node_delivery_ci_owner "https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/.github/workflows/ci.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer_main,node_customer_ui,node_customer_services,node_customer_map_utils,node_customer_state,node_customer_backend_entry,node_customer_backend_train,node_customer_backend_data toneBlue
class node_owner_main,node_owner_ui,node_owner_services,node_owner_map,node_owner_background,node_owner_firestore toneAmber
class node_customer_firebase_cfg,node_customer_assets,node_owner_backend,node_delivery_ci_customer,node_delivery_ci_owner toneMint
```

## Components

### Customer App

Flutter client for booking, fare estimation, and live trip following

- [Customer Shell](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/lib/main.dart): Flutter entrypoint · App bootstrap and navigation root · `golorry_customer_app-master/lib/main.dart`
- [Customer UI](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/screens): Screens · Onboarding, auth, booking, tracking, profile, and settings screens · `golorry_customer_app-master/lib/screens`
- [Customer Services](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/services): Service layer · Auth, booking, directions, tracking, geocoding, and user access · `golorry_customer_app-master/lib/services`
- [Map Logic](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/lib/utils): Trip mapping · Fare, markers, styles, and interpolation for trip visualization · `golorry_customer_app-master/lib/utils`
- [Tracking State](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/lib/providers/tracking_provider.dart): Provider state · Reactive propagation of tracking and trip updates · `golorry_customer_app-master/lib/providers/tracking_provider.dart`
- [Chatbot API](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/main.py): Python backend · Intent-driven backend entrypoint for customer-side assistant and integration · `golorry_customer_app-master/backend/main.py`
- [Model Train](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/train_model.py): NLP pipeline · Trains the intent model used by the customer assistant · `golorry_customer_app-master/backend/train_model.py`
- [Intent Data](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/backend/intents.json): NLP assets · Intents, trained model, and service credentials for the Python backend · `golorry_customer_app-master/backend/intents.json`

### Owner/Driver App

Flutter client for job acceptance, driver operations, and live tracking

- [Owner Shell](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/main.dart): Flutter entrypoint · App bootstrap and navigation root · `golorry_owner_driver_app_master/lib/main.dart`
- [Owner UI](https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/pages): Pages · Role selection, login, dashboard, jobs, earnings, profile, and settings · `golorry_owner_driver_app_master/lib/pages`
- [Owner Services](https://github.com/ashok-a15/go_laari/tree/main/golorry_owner_driver_app_master/lib/services): Service layer · Auth, Firestore access, geocoding, tracking, and background support · `golorry_owner_driver_app_master/lib/services`
- [Owner Map](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/widgets/owner_map.dart): Live map · Map presentation and driver location display · `golorry_owner_driver_app_master/lib/widgets/owner_map.dart`
- [Background Sync](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/services/background_service.dart): Runtime service · Keeps driver location and tracking updates running in the background · `golorry_owner_driver_app_master/lib/services/background_service.dart`
- [Firestore Bridge](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/lib/services/firestore_service.dart): Shared state access · Owner-side Firestore coordination for jobs and driver state · `golorry_owner_driver_app_master/lib/services/firestore_service.dart`

### Shared Platform

Firebase-backed coordination and delivery assets used across both apps

- [Firestore Config](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/firestore.rules): Firebase config · Firestore rules, indexes, and Android Firebase wiring · `golorry_customer_app-master/firestore.rules`
- [Login Assets](https://github.com/ashok-a15/go_laari/tree/main/golorry_customer_app-master/assets/lamp_login): Web asset bundle · Embedded HTML/CSS/JS login or landing assets · `golorry_customer_app-master/assets/lamp_login`
- [Backend Entry](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/backend/index.js): Node backend · Owner-side backend entrypoint for Firebase-oriented server logic · `golorry_owner_driver_app_master/backend/index.js`
- [Customer CI/CD](https://github.com/ashok-a15/go_laari/blob/main/golorry_customer_app-master/.github/workflows/flutter_build.yml): Build pipeline · GitHub Actions and Codemagic workflows for customer app delivery · `golorry_customer_app-master/.github/workflows/flutter_build.yml`
- [Owner CI/CD](https://github.com/ashok-a15/go_laari/blob/main/golorry_owner_driver_app_master/.github/workflows/ci.yml): Build pipeline · GitHub Actions workflows for owner app build and release · `golorry_owner_driver_app_master/.github/workflows/ci.yml`

## Connections

- Customer Shell → Customer UI: boots · Launches the customer navigation and screen flow
- Customer UI → Customer Services: uses · Screens call services for auth, booking, and trip data
- Customer UI → Tracking State: subscribes · UI reacts to live tracking state
- Customer Services → Map Logic: computes · Transforms booking and location data into routes, markers, fare, and camera behavior
- Customer Services → Firestore Config: reads/writes · Uses Firebase-backed persistence and shared trip state
- Tracking State → Firestore Config: syncs · Streams trip and driver updates from the shared backend state
- Customer Shell → Chatbot API: integrates · Connects the app to the customer assistant backend
- Chatbot API → Model Train: loads model · Uses trained intent model artifacts
- Model Train → Intent Data: trains from · Builds the model from intent data and credentials
- Customer UI → Login Assets: embeds · Uses packaged login/landing assets
- Owner Shell → Owner UI: boots · Launches the owner/driver navigation and page flow
- Owner UI → Owner Services: uses · Pages call services for auth, jobs, and tracking
- Owner UI → Owner Map: renders · Displays driver position and live trip maps
- Owner Services → Background Sync: starts · Keeps tracking active outside the foreground
- Owner Services → Firestore Bridge: reads/writes · Coordinates bookings, driver state, and operational data
- Owner Services → Owner Map: feeds · Provides live location data to the map view
- Firestore Bridge → Backend Entry: coordinates with · Shared operational state flows through the backend boundary
- Firestore Config → Firestore Bridge: shared plane · Both apps coordinate through Firebase/Firestore state
- Customer CI/CD → Customer Shell: builds · Customer app delivery pipeline
- Owner CI/CD → Owner Shell: builds · Owner app delivery pipeline
