How mygarden23/mygarden works
Project type and purpose
• This is a full-stack mobile application (“MyGarden”) built for Android using Kotlin and Jetpack Compose.
• It provides user authentication, cloud-backed data storage, photo capture and analysis, offline support, and push notifications to help users track and care for their plants.
File structure
• app/src/main/java/com/android/mygarden – Contains the core Android app code:
– ui/… (Compose screens, navigation, theming)
– model/… (domain entities, repositories, mapper, health calculator)
– MainActivity.kt (entry point)
• app/src/test & androidTest – Unit and instrumentation tests for every layer (UI, ViewModels, Repositories).
• build scripts (build.gradle.kts), CI workflows (.github/workflows), Firebase config (.firebaserc, firebase.json).
• Key top-level concerns: authentication, plant data, profile data, camera integration, local/offline mode, notifications.
README for additional insights
• Split App Model: managed auth, document database (Firestore), file storage, notification service (FCM).
• Multi-user support & social features (friends, leaderboard).
• Core feature: camera sensor for photo insights.
• Offline mode with continued access to garden data and notifications.
Main components and interactions
a. Client App
• UI Layer (Jetpack Compose screens + Navigation host)
• ViewModels (one per screen: SignIn, Camera, Garden, EditPlant, PlantInfo, Profile, Popup)
• Repositories (AuthRepository, PlantsRepository, ProfileRepository) with base, local, Firestore implementations
• Domain Models (Plant, Profile) and utilities (PlantHealthCalculator)
• Local Persistence (Firestore offline cache + optional local data store)
• Camera module (CameraViewModel + helper classes)
• Notification scheduler (local Android notifications)
b. External Cloud Services
• Firebase Authentication (email/password, Google sign-in)
• Google Sign-In OAuth
• Firebase Firestore (document database for plant and profile data, offline persistence)
• Firebase Storage (binary storage for plant photos)
• Firebase Cloud Messaging (push notifications for care reminders)
c. Device Resources
• Camera sensor (photo capture)
• Local notification manager
d. CI/CD Pipeline
• GitHub Actions (APK build, CI tests)
• Firebase emulator & instrumentation test environment
Architectural patterns & design principles
• MVVM (UI → ViewModel → Repository → Data source)
• Repository pattern with provider/factory to switch between local and Firestore implementations
• Single Activity + Compose Navigation (AppNavHost)
• Dependency injection (manual via Provider classes)
• Offline-first using Firestore’s local persistence + WorkManager or AlarmManager for notifications
• Modular separation: UI, domain, data