How iamsuryasonar/apparel-store-limo works
Main Components
• User Interface Layer: This includes the core React components (in the src/components directory), page components (under src/pages), and layout elements like Nav, Footer, and various presentation components.
• State Management: The Redux store (in src/store) with various slices (authSlice, cartSlice, categorySlice, etc.) that manage application state and facilitate data consistency across the app.
• Service/API Layer: Services under src/services provide functionalities like authentication, cart actions, product fetching, order processing, and payment integration. These encapsulate external API calls and business logic.
• Routing & Navigation: React Router is used to organize the different pages and components, including protected routes (using auth_guards in src/components/auth_guards).
• Utility and Hooks Layer: Custom hooks (under src/hooks) encapsulate reusable logic (e.g., debouncing, pagination, lazy loading, window sizing) and utilities (from src/utilities) that improve code maintainability.
Relationships and Interactions
• The User Interface interacts with the Redux store to reflect current state (shopping cart updates, authentication, product lists, etc.) and trigger changes via user actions.
• Redux slices dispatch actions that result in asynchronous calls via the service layer. For example, when a user adds an item to the cart, a cart service is called, and the cartSlice updates the state.
• The Routing layer orchestrates which page or component is presented based on URL and authentication status (private vs. public routes).
• External APIs (like Razorpay for payments) are invoked through the service layer, ensuring secure transactions.
• Lazy loading (for both images and components) is implemented, as seen in both component and hooks structure, to optimize resource usage and improve performance.
Architectural Patterns & Design Principles
• Separation of Concerns: The project is modularized by separating presentation (React components/pages), state management (Redux store), business logic (services), and common utilities (hooks and constants).
• Component-Based Architecture: Each UI piece is encapsulated in its own component, promoting reusability (e.g., Carousels, Shimmers, Form elements).
• Clean UI/State Flow: The unidirectional data flow from React UI to Redux state and then to Services (APIs) ensures predictable behavior.
• Lazy Loading and Performance Optimizations: Emphasized in the project by loading components and images only as needed.