How fer-haring/mvr-project works
Main Components
• Frontend/UI Layer:
• Pages and Routes: Use the “src/pages” folder that organizes pages like authentication (sign-in, sign-up, forgot-password), home, products, cart, admin, profile, and more. The “src/routes” folder connects these pages via routing guards or utilities.
• Business Logic / Controllers:
• Controllers: Under “src/controller”, you have feature-specific business logic that mixes UI components (e.g., admin panels, product details, cart steps) and acts as an intermediary between the UI and the data layer. These controllers aggregate data from various sources and conditionally render view elements.
• State Management:
• Store & Context: The “src/store” (with subfolders like “admin”, “auth”, “cart”, etc.) along with “src/context” (e.g., auth-context) represent centralized state management. They handle application state manually (or via libraries/hooks) and propagate data across components.
• Data and Integration Layer:
• SDK: The “src/sdk” directory encapsulates actions, mutations, types, and even Firebase integration logic—indicating communication with external services or APIs. This is where you formalize API calls for authentication, product operations, order processing, etc.
• Assets, Configuration, and Utilities:
• Assets: Contains static files like images, fonts, and videos.
• Configuration: MUI theming, constants, and regex are set up in “src/configuration”.
• Utilities & Translations: Provide helper functions and i18n support via “src/utils” and “src/translations”.
Relationships and Interactions
• The user interacts with UI pages (pages) that are composed of several reusable components.
• UI components (e.g., forms, buttons, modals) trigger events which are often handled in the controllers.
• Controllers use the SDK layer to call actions/mutations (for instance, interacting with Firebase or other back-end APIs) and then manipulate the global state via the store or context.
• The state changes are propagated back to the UI, updating parts of the interface or triggering re-renders.
• External libraries (like MUI for styling, react-router for navigation, SWC/Babel for compilation) support this overall flow.
Architectural Patterns
• Separation of Concerns: The project segregates UI, business logic, and data access into distinct directories.
• Component-Based Architecture: The use of highly modular components in “src/components” reflects a reusable, scalable UI design.
• Unidirectional Data Flow: With state stored in centralized “store” folders and updated via context/providers, the data flow is managed in a predictable way.
• Declarative Routing: Managed in “src/routes”, ensuring navigation is separated from component logic.
Relevant Technologies and Frameworks
• React with TypeScript for building the UI.
• Vite as the build tool and bundler.
• ESLint and Prettier for code quality and formatting (with configuration provided).
• Optionally, Material-UI and Firebase for styling and backend services respectively (as seen in “src/configuration/material-ui” and “src/sdk/firebase”).