Skip to content

Firebase setup

MealMind keeps everything in Firebase: users in Auth, all app data in Cloud Firestore, and images in Storage.

1. Generate the config

dart pub global activate flutterfire_cli
flutterfire configure

This regenerates lib/firebase_options.dart and android/app/google-services.json for your project.

Three Android package names

The apps use three application IDs: com.example.demo (customer), com.example.demo.chef and com.example.demo.admin. Register all three as Android apps in Firebase so each gets its own client entry in google-services.json. Google Sign-In won't work in the chef and admin apps until you do.

2. Turn on the services

  1. Authentication → Sign-in method: enable Email/Password and Google.
  2. Google Sign-In on Android: add your debug SHA-1 to each Android app in Project settings:
    cd android && ./gradlew signingReport
    
  3. Firestore Database: create a database. Test mode is fine while developing, then add security rules.

3. Seed the data the app expects

What Where Notes
Menu items menu collection Sample data in firebase/seed/menu.json
Categories categories collection Sample data in firebase/seed/categories.json
Bill counter counters/bill_counter → { "lastBillNum": 0 } Required. Bill generation fails without it.
Tables tableDetail/{id} → { "tableNumber": "1", "isOccupied": false, "label": "Table 1" } One per physical table, used by QR check-in
Staff users/{uid}.role = "chef" or "admin" Unlocks the chef and admin apps

The two JSON files use the __collections__ export format, which node-firestore-import-export understands:

npx -p node-firestore-import-export firestore-import \
  -a path/to/your-service-account.json -b firebase/seed/menu.json
npx -p node-firestore-import-export firestore-import \
  -a path/to/your-service-account.json -b firebase/seed/categories.json

Keep service-account keys out of the repo

serviceAccountKey.json and similar files are in .gitignore. Store them outside the project folder and never commit them.

Tag menu items (optional)

tool/tag_menu_items.dart writes a tags array (e.g. Starter, Spicy, Popular) onto each menu document. Edit the map in the file, then run it like an app:

flutter run -t tool/tag_menu_items.dart

4. Make yourself an admin

Sign up once in the customer app, then open your users/{uid} document in the Firestore console and set role to "admin". After that, you can change everyone else's role from the admin app's Users tab.

Every collection and field is listed in the Firestore schema.

Next: run and build the apps →