How thenifemi/petshop works
Main components
• Flutter Mobile Application (Frontend)
• Built using Flutter and organized under the “lib” directory.
• Contains multiple layers: models (data and notifiers), services (e.g., authentication, product service, push notifications, user management), screens (login, registration, home, product details, checkout, etc.), widgets, and utilities.
• Uses Provider architecture for state management.
• Platform-Specific Projects:
• Android: All native Android files under the “android” directory.
• iOS: The “ios” directory with native iOS configurations.
• Backend Services (Cloud & External APIs):
• Firebase Authentication: Used for user authentication (FirebaseAuth).
• Firebase Cloud Firestore: Acts as the main database.
• Firebase Cloud Functions: Located in the “functions” folder; used for backend logic.
• Google Places API: For location reading service.
• External storage for images: Store images (fetched from Amazon).
Detail the relationships and data flow
• The Flutter app (client) communicates directly with Firebase for authentication and database operations.
• The provider notifiers and services in the “lib/model” layer wrap these Firebase and external API interactions to update the UI accordingly.
• The mobile UI (widgets and screens) uses the provider pattern to reflect state changes coming from backend service calls.
• Cloud Functions provide backend logic and may interact with Firestore and other external services.
• Native platform configurations for Android and iOS contain integration points (e.g., google-services.json for Android, GoogleService-Info.plist for iOS) to bridge Flutter with native functionalities.
Architectural patterns and design principles
• Provider Architecture: Central to state management, with each “notifier” representing a slice of the app’s state.
• Clean separation of concerns: Models (data and services) are separated from UI (screens and widgets) and configuration.
• Use of third-party services (Firebase, Google Places API, Amazon imaging) is prominently integrated within service layers.
• Modular design with clear separation between UI, business logic (services), and data models.
Relevant technologies and frameworks
• Flutter (Dart language) for building the UI.
• Firebase (FirebaseAuth, Cloud Firestore, Cloud Functions) for backend services.
• Provider package for state management.
• Google Places API for location data.
• Native configurations for Android and iOS to handle platform-specific features.
Elements
• UI Components: Screens and Widgets.
• State Management: Providers/Notifiers.
• Business Logic/Services: Authentication service, Products service, Push notifications service, etc.
• Data Models: Classes defined for Products, Orders, User Data, etc.
• Backend Components:
• Firebase Auth and Firestore as cloud services.
• Cloud Functions (depicted as an independent service that interacts with Firestore and possibly triggers notifications).
• External APIs & Services:
• Google Places API for location.
• Amazon (or external storage) for images.
• Data and event flow from the Flutter UI to the Providers and then to the Firebase backend.
• Communication from Firebase Cloud Functions to Firestore and possibly to the mobile client.
• Integration flows for external APIs (e.g., location or image fetching).
• Rectangles for system components.
• Ovals or circles for data stores (such as Firebase Firestore).