How kawaki0101/grocery_app works
Project Type and Purpose
• This is a React Native mobile application (“Grocery_app”) targeting both Android and iOS.
• It is structured as a client‐only front end that interacts with remote APIs (via AuthService, Axios interceptors, etc.), manages local state (Zustand + MMKV), and renders UI screens (features, components).
High-Level Architectural Components
a. Native Platforms
• Android (Java/Kotlin code under android/…)
• iOS (Swift/Objective-C under ios/…)
• Metro Bundler (JS bundler serving the JS bundle to device)
b. React Native Bridge
• Mediates between JS thread and native modules (UI views, native storage, device APIs)
c. JavaScript Layer
1. Entry Point
– index.js → registers App.tsx via AppRegistry
2. Navigation Layer
– src/navigation/Navigation.tsx uses React Navigation to wire up feature screens
3. Presentation Layer (Screens & Components)
– src/features/* (SplashScreen, CustomerLogin, DashBoard, DeliveryDashboard, etc.)
– src/components/global/ui (CustomButton, CustomInput, CustomText)
4. State Management
– src/state/authStore.tsx & mmkvStorageForZustand.ts for persisting auth (Zustand + MMKV)
5. Service Layer
– src/Service/AuthService.tsx (login/logout API calls)
– src/Service/apiInterceptors.tsx (Axios request/response interceptors)
– src/Service/config.tsx (base URLs, timeouts)
6. Utility and Assets
– src/utils (Constants, DateUtils, Themes, CustomMap, helper hooks)
External Systems
• Remote REST/GraphQL API servers for auth and grocery data
• Third-party services (e.g., maps, analytics) if any
Key Architectural Patterns & Design Principles
• Feature-based folder structure (each “feature” encapsulates its screen and related logic)
• Layered separation: Presentation ←→ State ←→ Service ←→ Network
• Unidirectional data flow (components dispatch actions → state updates → UI re-renders)
• Bridge pattern between JS and native modules