How ananduvijay/ecomstore works
Project type and purpose
• This is a React Native mobile application for an e-commerce store (“EcomStore”) that runs on both Android and iOS.
• The JavaScript code (under src/) implements product listing, shopping cart screens, navigation, and global state (via React Context).
• Native folders (android/ and ios/) contain platform-specific bootstrap code, resources, and build configurations.
File structure
• Top-level:
• android/ & ios/ → Native projects, Gradle & Xcode setups, platform resources.
• src/ → All JS/TSX application code:
– assets/ (images & constants)
– context/ (CartContext.js for global state)
– navigation/ (AppNavigation.js for React Navigation setup)
– screen/ (screen-level folders: productListing, cart; each with components & styles)
• index.js & App.js → JS entrypoints
• metro.config.js, babel.config.js → bundler & transpiler configs
• package.json, yarn.lock → dependencies & scripts
Extract architecture hints from the README
• Bootstrapped with @react-native-community/cli
• Metro bundler serves JS to native shell
• Typical RN dev workflow described (npm/yarn start, run on emulator)
Main components
A. React Native JS Layer
• UI Screens (ProductListingScreen, CartScreen)
• Components (ProductCard, CartItems, CheckoutBar, AddressBox, etc.)
• Navigation module (React Navigation)
• State management (CartContext)
• Assets & styling modules
B. Bundler & Tooling
• Metro Bundler (serves JS bundle)
• Babel (transpiles modern JS/TS)
• Yarn / npm (package manager)
C. Native Shells
• Android native project (Gradle, MainActivity.kt, MainApplication.kt)
• iOS native project (Xcode project, AppDelegate, Info.plist)
• React Native Bridge (JS ↔ native module communication)
• REST / GraphQL APIs (product catalog, cart management, auth, payments)
• Third-party SDKs (e.g. analytics, crash reporting)
Relationships and interactions
• Metro Bundler → serves a JS bundle → loaded into Native Shell at runtime
• JS Layer (UI & business logic) → via React Native Bridge → invokes native modules (camera, storage)
• JS Layer → HTTP calls → External API servers → returns JSON data → UI updates via Context
• Navigation component routes between screens, passing props/state
• CartContext holds global state, consumed by screen components
Architectural patterns & design principles
• Single Page App pattern inside a mobile container
• Modular screen/component decomposition (each screen folder encapsulates its UI and logic)
• Unidirectional data flow via Context API
• Clear separation: UI components ↔ business logic ↔ data layer (API)
• Native / JS boundary over React Native Bridge