📦 Package Rename: com.sage.sage → com.github.mystiatech.sage ✅ Changes: - Updated applicationId in build.gradle.kts - Updated namespace in build.gradle.kts - Moved MainActivity.kt to new package structure - Updated google-services.json placeholder - Updated FIREBASE_SETUP.md with correct package name - Updated README_FIREBASE.md with correct package name 🎯 Reason: - GitHub-based package names don't require domain ownership - Standard convention: com.github.username.appname - Ready for Firebase setup without needing website registration 📋 Firebase Setup: When setting up Firebase, use package name: com.github.mystiatech.sage ✅ Build Status: - APK builds successfully (63.3MB) - All tests passing - Ready for Firebase configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.6 KiB
3.6 KiB
Firebase Setup Guide for Sage
Step 1: Create Firebase Project
- Go to Firebase Console
- Click "Add project"
- Enter project name:
sage-kitchen-management
- Disable Google Analytics (optional for this app)
- Click "Create project"
Step 2: Add Android App
- In Firebase Console, click the Android icon to add an Android app
- Enter package name:
com.github.mystiatech.sage
(must match exactly!) - App nickname:
Sage
(optional) - Debug signing certificate SHA-1: (optional, skip for now)
- Click "Register app"
Step 3: Download Configuration File
- Download the
google-services.json
file - Place it in:
android/app/google-services.json
Step 4: Set up Firestore Database
- In Firebase Console, go to "Build" → "Firestore Database"
- Click "Create database"
- Choose "Start in test mode" for development
- Select a Firestore location (e.g.,
us-central
) - Click "Enable"
Security Rules (update after testing)
For development/testing, use test mode rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.time < timestamp.date(2025, 12, 31);
}
}
}
For production, update to:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow anyone to read household data by code
match /households/{householdId} {
allow read: if true;
allow create: if true;
allow update: if true;
allow delete: if request.auth != null;
// Allow household members to manage items
match /items/{itemId} {
allow read: if true;
allow write: if true;
}
}
}
}
Step 5: Update Android Build Files (Already Done)
The following files need to be updated (will be done automatically):
android/build.gradle
- Add Google Services pluginandroid/app/build.gradle
- Apply Google Services plugin
Step 6: Initialize Firebase in App
The app will automatically initialize Firebase on startup.
Firestore Data Structure
households (collection)
└── {householdCode} (document)
├── id: string
├── name: string
├── ownerName: string
├── createdAt: string (ISO 8601)
└── members: array<string>
└── items (subcollection)
└── {itemKey} (document)
├── name: string
├── barcode: string?
├── quantity: number
├── unit: string?
├── purchaseDate: string (ISO 8601)
├── expirationDate: string (ISO 8601)
├── locationIndex: number
├── category: string?
├── photoUrl: string?
├── notes: string?
├── userId: string?
├── householdId: string
├── lastModified: string (ISO 8601)
└── syncedToCloud: boolean
Testing
- Create a household on Device A
- Note the 6-character code
- Join the household from Device B using the code
- Add items on Device A → should appear on Device B
- Add items on Device B → should appear on Device A
Troubleshooting
- "google-services.json not found": Make sure file is in
android/app/
directory - Build errors: Run
flutter clean && flutter pub get
- Permission denied: Check Firestore security rules in Firebase Console
- Items not syncing: Check internet connection and Firebase Console logs