How divk-ashwin/food-rescue works
Main Components
• Mobile Application (Android App) – This is the central piece of the system.
• User Interface Layer – Comprises all UI components such as MainActivity, ComposableScreens.kt, and XML layout files found in the “app/src/main/res/” directory.
• Application Logic Layer – Includes the ViewModels (FoodFeedViewModel, viewModel.kt) and the application-wide class FoodRescueApplication.kt which initializes Firebase. This layer follows the MVVM pattern.
• Data/Repository Layer – Represented by FirestoreRepository.kt. This component abstracts the interaction with the backend.
• Backend Services – Firebase services (both Firestore as the main database and Firebase Authentication). Also include Firebase Cloud Firestore rules and collections as described in the README.
• External Services – Google Maps API integration for map-based features, which allows location display of food posts.
Out the Component Relationships
• MVVM Flow: The UI components call the ViewModel for business logic. Then, the ViewModel communicates with the Repository (FirestoreRepository) to perform data operations.
• Backend Communication: The Repository directly interfaces with Firebase services – both reading and writing to Firestore and handling authentication. Represent directional data flows (requests and responses) between these components.
• External API Calls: The app also integrates with Google Maps; so include a connection between UI components (or possibly a dedicated “Maps” component within the UI) and the external Google Maps API.
Architectural Patterns and Design Principles
• MVVM Pattern: Emphasize the clear separation between UI (Composable screens and layouts), the ViewModels (handling the app’s logic), and the Repository (data abstraction with Firebase).
• Separation of Concerns: Each component is responsible for a specific set of tasks:
– UI handles rendering and user interaction.
– ViewModel manages state and mediates between UI and the data layer.
– Repository encapsulates data operations (CRUD operations with Firestore).
• Modularization: The project structure separates concerns by using directories for UI, business logic, and repository code. Indicate this modularity with clearly labeled blocks.