How sumit-22/shopping-cart works
Project Type & Purpose
• BlinkShop is an Android e-commerce mobile application built in Kotlin, following the MVVM (Model-View-ViewModel) architecture.
• It provides user and admin modules, authentication (Firebase Auth), product browsing, cart management (Room DB), payment integration (Razorpay), real-time order tracking (Firestore + Google Maps), and push notifications (FCM).
Key File-Structure Insights
• Top-level “app” module: Android Gradle module with source under src/main
• activity/ & fragments/: UI screens (XML + Kotlin)
• adapters/: RecyclerView adapters for lists
• viewmodels/: AuthViewModel & userViewModel for LiveData & UI logic
• api/: Retrofit ApiInterface & ApiUtilities for network calls
• roomdb/: Room entities, DAO, Database for offline cart
• models/: Data classes for Firestore/JSON mapping
• auth/, delivery/, deliverydash/: Feature-specific UI logic
• Utils, Constants, NotificationService, FCMTokencallback: cross-cutting utilities
• Configuration: google-services.json (Firebase), proguard, Gradle scripts.
a. UI Layer
• Activities & Fragments (Home, Auth, Cart, Orders, Delivery Dash)
• Layout XML resources
b. ViewModel Layer
• AuthViewModel, userViewModel exposing LiveData to UI
c. Repository / Data Layer
• Retrofit (ApiInterface → REST endpoints)
• Firebase Firestore / Firebase Auth
• Room DB (CartProductsDatabase)
• SharedPreferences (Utils)
d. Services & External Systems
• Firebase Cloud Messaging (NotificationService)
• Razorpay SDK (Payment processing)
• Google Maps API (Real-time location)
e. Models
• Domain objects (Product, Orders, Users, DeliveryPartner)
Relationships & Data Flow
• UI → observes → ViewModel
• ViewModel → calls → Repository methods
• Repository → either:
• fetch/write → Firestore/Firebase Auth
• perform → Retrofit network operations
• query → Room DB
• External events (FCM pushes) → NotificationService → triggers UI updates
• Payment flow: UI initiates → Razorpay SDK → payment callback → ViewModel updates Firestore
Architectural Patterns & Principles
• MVVM separation: UI vs business logic vs data
• Repository pattern: abstracting data sources
• Single-source-of-truth: Room + Firestore sync
• Dependency inversion via interfaces (ApiInterface, DAOs)
Essential Elements to Capture
• All Activities/Fragments as entry points
• ViewModels mediating UI and data
• Multiple data sources (Firestore, REST API, Room)
• External integrations (FCM, Razorpay, Maps)
• Repository as the central abstraction layer