A complete production-ready full-stack food delivery application with real-time tracking, multi-role support, and modern UI/UX using Material 3.
The customer app allows users to browse restaurants, add items to the cart, check out via Stripe, and track their delivery in real-time. (Screenshots placeholder: Customer Home, Restaurant Menu, Checkout, Live Tracking)
The restaurant dashboard allows restaurant owners to accept/reject orders, manage menu items, and view daily revenues. (Screenshots placeholder: Order Incoming, Dashboard, Menu Management)
The driver app provides drivers with delivery requests, turn-by-turn navigation, and an earnings dashboard. (Screenshots placeholder: Driver Home, Delivery Map, Earnings)
The app uses Clean Architecture combined with Feature-first folder structure and BLoC for state management.
graph TD
UI[Presentation Layer - UI] --> BLoC[State Management - BLoC/Cubit]
BLoC --> UseCases[Domain Layer - Use Cases]
UseCases --> Repositories[Domain Layer - Repository Interfaces]
Repositories --> DataRepos[Data Layer - Repository Implementations]
DataRepos --> RemoteDS[Remote Data Source - Firebase/Stripe]
DataRepos --> LocalDS[Local Data Source - SharedPrefs/Hive]
- Create a new Firebase project at Firebase Console.
- Enable Authentication (Phone Number, Google Sign-In).
- Enable Firestore Database and Firebase Storage.
- Install the FlutterFire CLI:
dart pub global activate flutterfire_cli - Run the configuration command in the root of your project:
flutterfire configure
- Deploy the Firestore Security Rules & Indexes based on the collections below.
users/{uid}: role, name, phone, address, profilePhotorestaurants/{id}: name, cuisine, rating, deliveryTime, isOpen, location (GeoPoint)menus/{restaurantId}/items/{itemId}: name, price, photo, categoryorders/{orderId}: userId, restaurantId, driverId, items[], status, timestampsdrivers/{uid}: isAvailable, location (GeoPoint), currentOrderId
This project uses --dart-define and .env files for environment configurations.
- Create a
.envfile in the root directory (do not commit this to version control).
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_key_here
GOOGLE_MAPS_API_KEY=AIzaSy_your_google_maps_key_here- To run the app with environment variables:
flutter run --dart-define-from-file=.envOr via IDE configurations by passing --dart-define=STRIPE_PUBLISHABLE_KEY=...
- Clone the repository.
- Run
flutter pub getto fetch dependencies. - Setup Firebase and
.envas described above. - Run
flutter runon your preferred device.
This project includes production-oriented security rules for Firestore and Firebase Storage to ensure that users, restaurants, and drivers only access and modify data relevant to their roles.
- Role-Based Access: Customers can only place orders for themselves; restaurants can only manage their own orders and menus; drivers can only view available orders and update orders assigned to them.
- Immutable Fields: Critical user fields like
role,restaurantId, anddriverIdcannot be modified after user creation. - Strict Status Transitions: Order status can only be updated through logical steps (e.g.,
confirmed→preparing→readyForPickup). - Secure Drivers Data: Drivers' locations and availability are only visible to the relevant customer and restaurant for an active order.
Ensure you have the Firebase CLI installed and initialized.
-
Login to your Firebase account:
firebase login
-
Initialize Firebase in your project if you haven't (select Firestore and Storage):
firebase init
-
Deploy the rules using the following command:
# Deploy Firestore rules firebase deploy --only firestore:rules # Deploy Storage rules firebase deploy --only storage
Alternatively, you can copy the contents of firestore.rules and storage.rules directly into the "Rules" tab of the Firestore and Storage sections in the Firebase Console.