Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš— RoadMate

On-Demand Roadside Assistance Platform

Connecting stranded drivers with nearby mechanics β€” in real time.

Flutter Dart Firebase Platform Architecture


πŸ“– Overview

RoadMate is a real-time roadside assistance marketplace. When a driver breaks down, they raise a request; nearby mechanics are notified instantly, accept the job, and navigate to the driver β€” with live location tracking, in-app chat, and fare estimation throughout.

The platform sustains itself through a prepaid mechanic wallet: since driver↔mechanic payments happen in cash, RoadMate pre-collects revenue at recharge time and deducts a commission (default 5%) from the mechanic's wallet after each completed job.

Status: Feature-complete, pre-launch. Preparing for Google Play release β€” see the Roadmap.


✨ Features

πŸ‘€ For Drivers

Feature Description
πŸ”§ Request Assistance Broadcast a breakdown request to nearby mechanics in real time
πŸ—ΊοΈ Find Mechanics Browse nearby mechanics and workshops on an interactive map
πŸ“ Live Tracking Watch the assigned mechanic approach in real time
πŸ’¬ In-App Chat Message the mechanic directly once the request is accepted
🧠 Smart Diagnosis Rule-based guided wizard that narrows down the likely fault before you call anyone
πŸ’° Fare Estimation Distance-based fare preview before confirming
🚨 SOS One-tap emergency screen for critical situations
⭐ Ratings & Reviews Rate the mechanic after job completion
πŸ“œ History Full record of past requests and services

πŸ”§ For Mechanics

Feature Description
πŸ“’ Job Requests Receive live push notifications for nearby breakdowns
🟒 Online / Offline Toggle availability to control incoming jobs
πŸ‘› Prepaid Wallet Top up balance; commission is auto-deducted per completed job
πŸ’³ Recharge Submit an Easypaisa / JazzCash transaction for admin verification
🧾 Profile & Verification Workshop details, services offered, experience, CNIC upload
πŸ“ˆ Earnings & Ratings Auto-aggregated rating, computed server-side by Cloud Functions

πŸ›‘οΈ For Admins

Feature Description
βœ… Recharge Approval Verify incoming payments and credit mechanic wallets
πŸ‘₯ User Management Oversee drivers and mechanics
βš™οΈ Remote Pricing Config Change commission rate, minimum balance, and visit fee from Firestore β€” no app rebuild required

πŸ—οΈ Architecture

RoadMate follows Clean Architecture with the MVVM presentation pattern. State is managed with provider.

lib/
β”œβ”€β”€ models/          # Firestore-mapped data structures
β”‚                    #   UserModel Β· DriverModel Β· MechanicModel
β”‚                    #   ServiceRequestModel Β· WalletModel Β· ReviewModel
β”‚                    #   ChatMessageModel Β· PricingConfig Β· NearbyMechanic
β”‚
β”œβ”€β”€ repositories/    # Data access β€” the ONLY layer that touches Firebase
β”‚                    #   Auth Β· User Β· ServiceRequest Β· Tracking
β”‚                    #   Review Β· Wallet Β· Storage Β· Diagnosis
β”‚
β”œβ”€β”€ viewmodels/      # State + business logic (ChangeNotifier)
β”‚                    #   Auth Β· Request Β· Chat Β· Wallet
β”‚
β”œβ”€β”€ pages/           # Screens (Views)
β”‚                    #   Auth Β· Driver/Mechanic/Admin Dashboards
β”‚                    #   Chat Β· Wallet Β· Recharge Β· SOS Β· Profile Β· History …
β”‚
β”œβ”€β”€ components/      # Reusable widgets
β”‚                    #   MapComponent Β· DiagnosisWizard Β· PaymentDialog
β”‚                    #   RatingDialog Β· AppDrawer Β· MobileLayout
β”‚
β”œβ”€β”€ services/        # Domain services, framework-agnostic
β”‚                    #   DiagnosisEngine Β· FareEstimator Β· LocationService
β”‚                    #   MechanicFinder Β· NearbyShops Β· Notifications Β· EmailOTP
β”‚
└── theme/           # Design system

Data flow

View  ──▢  ViewModel  ──▢  Repository  ──▢  Firebase
 β–²                                              β”‚
 └──────────  notifyListeners()  β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Backend β€” Firebase

Service Role
Cloud Firestore Primary datastore β€” users, requests, wallets, reviews, chat
Realtime Database High-frequency GPS location streaming (cheaper & faster than Firestore for this)
Cloud Storage Profile photos, CNIC images
Cloud Messaging (FCM) Push notifications for new & accepted requests
Cloud Functions onNewRequest β†’ notify nearby mechanics Β· onRequestAccepted β†’ notify the driver Β· rating aggregation
App Check Abuse protection

πŸš€ Getting Started

Prerequisites

  • Flutter SDK β‰₯ 3.0.0 Β· Dart β‰₯ 3.0.0
  • Node.js (for Cloud Functions)
  • Firebase CLI β€” npm install -g firebase-tools
  • A Google Maps API key

1. Clone & install

git clone https://github.com/abdullahsokay/RoadMate.git
cd RoadMate
flutter pub get

2. Firebase setup

Create a project in the Firebase Console, then enable:

  • Authentication β†’ Anonymous (backs the app's email-OTP session)
  • Firestore Database
  • Realtime Database (live location tracking)
  • Cloud Storage (profile / CNIC uploads)
  • Cloud Messaging

Register your Android app and drop google-services.json into android/app/. For iOS, drop GoogleService-Info.plist into ios/Runner/.

πŸ“„ Detailed walkthrough: FIREBASE_SETUP.md

3. Google Maps

Enable Maps SDK for Android / iOS in the Google Cloud Console, generate an API key, then:

Android β€” android/app/src/main/AndroidManifest.xml

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_API_KEY_HERE"/>

iOS β€” ios/Runner/AppDelegate.swift

GMSServices.provideAPIKey("YOUR_API_KEY_HERE")

⚠️ Before going public: restrict the key to your Android SHA-1 + package name in the Cloud Console. An unrestricted Maps key that leaks will be abused and billed to your account.

4. Deploy Cloud Functions

cd functions
npm install
firebase login
firebase deploy --only functions

5. Security rules

firebase deploy --only firestore:rules,storage:rules,database

Rules live in firestore.rules, storage.rules, and database.rules.json.

6. Run

flutter run

πŸ’Έ Wallet & Commission

Payments between driver and mechanic are settled in cash β€” so the platform can't skim a cut from the transaction itself. Instead:

1.  Mechanic recharges  PKR 1000   β†’  money lands in the platform account
2.  Wallet shows        PKR 1000   β†’  credit (a liability owed as service)
3.  Job completed       βˆ’5%        β†’  a slice becomes recognised revenue
4.  Balance < minimum   β›”          β†’  mechanic can't accept new jobs until they top up

Revenue is therefore pre-collected at recharge time β€” no chasing commission payments, and only one account to manage.

Recharge is currently manual: the mechanic pays via Easypaisa/JazzCash and submits the Transaction ID; an admin verifies and credits the wallet. A payment-gateway integration (Safepay / PayFast / Paymob) is the planned upgrade for scale.

Commission rate, minimum balance, starting bonus, and visit fee are all read from Firestore (config/pricing) β€” change them without shipping a new build.

πŸ“„ Full details: RECHARGE_AND_COMMISSION.md Β· WALLET_SETUP.md


πŸ§ͺ Testing

flutter test

Covers the diagnosis engine and the auth view-model.


πŸ—ΊοΈ Roadmap to Production

  • Change applicationId from com.example.roadmate to a real domain β€” Play Store rejects com.example.*
  • Release signing β€” generate a keystore, wire up key.properties, sign the App Bundle
  • Restrict the Maps API key to the release SHA-1 + package name
  • Harden Firestore rules β€” the current identity model (anonymous auth keyed by an email-derived id) prevents per-owner rules; migrating to Firebase-native email/password auth would make request.auth.uid trustworthy
  • Target SDK 35 β€” mandatory for new Play Store submissions
  • Privacy Policy hosted at a public URL β€” required, as the app collects location, phone, and payment data
  • Data Safety form in the Play Console
  • Payment gateway integration to automate recharges
  • Store listing assets β€” icon, feature graphic, screenshots

πŸ› οΈ Tech Stack

Layer Technology
Framework Flutter Β· Dart
State Provider (MVVM)
Backend Firebase β€” Firestore Β· Realtime DB Β· Storage Β· Auth Β· FCM Β· Functions Β· App Check
Maps & Location google_maps_flutter Β· flutter_map Β· geolocator Β· location
Media image_picker Β· flutter_image_compress
Utilities flutter_local_notifications Β· url_launcher Β· share_plus Β· crypto Β· intl

πŸ“ Project Layout

RoadMate/
β”œβ”€β”€ lib/                 # Flutter application source
β”œβ”€β”€ functions/           # Firebase Cloud Functions (Node.js)
β”œβ”€β”€ android/  ios/       # Native platform shells
β”œβ”€β”€ web/  windows/  …    # Additional Flutter targets
β”œβ”€β”€ test/                # Unit & widget tests
β”œβ”€β”€ firestore.rules      # Firestore security rules
β”œβ”€β”€ storage.rules        # Cloud Storage security rules
β”œβ”€β”€ database.rules.json  # Realtime Database rules
└── firebase.json        # Firebase project config

Built with Flutter & Firebase

About

On-demand roadside assistance platform connecting stranded drivers with nearby mechanics in real time. Built with Flutter and Firebase.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages