How medora0/fruit_hub works
Project Type & Purpose
• A cross-platform (Android, iOS, Web, Desktop) e-commerce mobile app built in Flutter.
• Clean-architecture layers with BLoC/Cubit state management.
• Backend services entirely serverless: Firebase (Auth, Firestore) + PayPal integration.
High-Level Architecture Components
A. Presentation Layer (Client UI)
– Flutter Widgets & Views (lib/features/…/presentation/views)
– Cubits (lib/core/cubits + lib/features/…/presentation/cubits)
– Routes (on_generate_routes)
– Entry point: main.dart
B. Domain Layer
– Entities (lib/core/entities + lib/features/…/domain/entities)
– Repository Interfaces (lib/core/repos/*.dart + lib/features/…/domain/repository)
C. Data Layer
– Repository Implementations (lib/core/repos/*_impl.dart + lib/features/…/data/repository/*.dart)
– Data Models (lib/core/models, lib/features/…/data/models)
D. Infrastructure / Core Services
– FirebaseAuthService, FirestoreService (lib/core/services)
– SharedPreferencesSingleton, DatabaseService
– get_it Service Locator (GetItService)
E. External Systems
– Firebase Authentication
– Firestore Database
– PayPal REST API
– Social Auth Providers (Google, Facebook, Apple)
Component Interactions & Data Flow
1. User taps UI widget → triggers Cubit event.
2. Cubit calls Domain-level repository interface.
3. Repository implementation uses Core Service (FirebaseAuthService, FirestoreService, SharedPreferences).
4. Core Service issues HTTP/SDK calls to external systems (Firebase, PayPal).
5. Responses travel back up: Service → Repo → Cubit → UI.
Architectural Patterns & Principles
• Clean Architecture: strict separation of Presentation / Domain / Data / Infrastructure.
• BLoC Pattern with Cubit for state management.
• Dependency Injection via get_it.
• Feature-based module organization.
• Layered reusable “core” for shared code.
Technologies & Frameworks
– Flutter & Dart (UI)
– BLoC/Cubit (State)
– Firebase SDK (Auth, Firestore)
– SharedPreferences (Local storage)
– PayPal REST API (Payments)
– get_it (Service locator / DI)
– Clean Architecture
Essential Elements
• Annotation of external dependencies (Firebase, PayPal)