# teojiesern/shuttlestop-fe architecture

> Architecture diagram of the GitHub repository teojiesern/shuttlestop-fe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/teojiesern/shuttlestop-fe
- Repository: https://github.com/teojiesern/shuttlestop-fe

## Overview

##### Project Type and Purpose
- This is a frontend-only, single page application focused on multiple domains such as customer interactions, checkout processes, CIAM (Customer Identity & Access Management), seller center functionalities, marketing, and the main landing experience.
- The codebase is structured around modular features, where each domain (e.g., checkout, ciam, customer, marketing, sellerCenter) contains its own data repository implementations, UI views, components, hooks, navigation, and modals.

##### Analyzing the File Structure
- Top Level: Files such as index.html, package.json, and configuration files (e.g., .eslintrc.json, .prettierrc.json) indicate a standard React/Vite project.
- src Directory: Contains an “app” folder which is broken out by domain-specific subdirectories (checkout, ciam, customer, main, marketing, sellerCenter) and a “platform” folder.
- Each module subfolder further divides into layers such as data (repositories and static data), navigation (screens dedicated to routing within the module), view (presentation components and screens), modal (pop-up UI components), hooks (custom React hooks for business logic), and sometimes styles.
- The “platform” folder gathers cross-cutting concerns such as shared layouts, global styling, theming, network configuration, common components (headers, footers, modal managers), contexts, and utilities. This acts like a “base layer” that reinforces the overall design and functionality across the various domain modules.

##### Key Components
a. Main Application Container:
- Overall application as “ShuttleStop-FE (React SPA)” which is orchestrated by Vite.
- That React Router (with components like AuthenticatedRoute and SellerCenterAuthenticatedRoute) routes user navigation between modules.
b. Domain-Specific Modules:
- Data Layer: Repositories and data sources (e.g., CheckoutRepositoryImpl.js, CIAMRepositoryImpl.js)
- Navigation Layer: Screens and routes (e.g., CheckoutScreens.jsx, CustomerScreens.jsx)
- View / UI Layer: Presentation components (e.g., CheckoutScreen, Login, Signup, etc.), modals, and components
- Hooks: Custom hooks that handle the business logic (e.g., useOrder.js, useLogin.js)
c. Platform / Shared Components:
- A central “Platform” component that includes shared components (Header, Footer), context providers (CustomerInfoContext, SellerInfoContext), layouts (AuthLayout, MainLayout, SellerCenterLayout), global styles, animations, and network configuration.
- That shared cross-cutting utilities like styling (globalStyles, theme) are provided by this layer.

##### Relationships and Interactions
- All modules interact with the shared “Platform” for global state management via Contexts, theming, and common UI components.

##### Architectural Patterns and Technologies
- Modular design and separation of concerns: Each module is self-contained with its own UI, business logic, and data handling.
- Use of Repository Pattern: All backend interactions seem encapsulated in repository implementations.
- Component-Driven UI: Reusable components, layouts, and modals provided by both modules and shared in the platform.
- Integration with third-party libraries: Material-UI for design, Styled Components for styling, React Router for navigation, and tooling support (ESLint, Prettier, Husky) for developer experience.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Application Container
    MA["ShuttleStop-FE (React SPA)"]:::main
    R["Router (React Router)"]:::main
    MA -->|"routes"| R

    %% Checkout Module
    subgraph "Checkout Module"
        C_N["Checkout - Navigation (CheckoutScreens.jsx)"]:::module
        C_V["Checkout - View (CheckoutScreen.jsx)"]:::module
        C_H["Checkout - Hooks (useOrder.js)"]:::module
        C_D["Checkout - Data (CheckoutRepositoryImpl.js)"]:::module
        C_N -->|"renders"| C_V
        C_V -->|"uses"| C_H
        C_H -->|"calls"| C_D
    end

    %% CIAM Module
    subgraph "CIAM Module"
        CIAM_N["CIAM - Navigation (CIAMScreens.jsx)"]:::module
        CIAM_V["CIAM - View (Login.jsx)"]:::module
        CIAM_H["CIAM - Hooks (useLogin.js)"]:::module
        CIAM_D["CIAM - Data (CIAMRepositoryImpl.js)"]:::module
        CIAM_N -->|"renders"| CIAM_V
        CIAM_V -->|"uses"| CIAM_H
        CIAM_H -->|"calls"| CIAM_D
    end

    %% Customer Module
    subgraph "Customer Module"
        Cust_N["Customer - Navigation (CustomerScreens.jsx)"]:::module
        Cust_V["Customer - View (MyProfile.jsx)"]:::module
        Cust_H["Customer - Hooks (useCustomer.js)"]:::module
        Cust_D["Customer - Data (CustomerRepositoryImpl.js)"]:::module
        Cust_N -->|"renders"| Cust_V
        Cust_V -->|"uses"| Cust_H
        Cust_H -->|"calls"| Cust_D
    end

    %% Main Module
    subgraph "Main Module"
        Main_D["Main - Data (homeBanner.js)"]:::module
        Main_V["Main - View (MainScreen.jsx)"]:::module
        Main_V -->|"reads"| Main_D
    end

    %% Marketing Module
    subgraph "Marketing Module"
        Mkt_N["Marketing - Navigation (MarketingScreens.jsx)"]:::module
        Mkt_V["Marketing - View (CompetitionScreen.jsx)"]:::module
        Mkt_H["Marketing - Hooks (useCoachDetail.js)"]:::module
        Mkt_D["Marketing - Data (CompetitionRepositoryImp.js)"]:::module
        Mkt_N -->|"renders"| Mkt_V
        Mkt_V -->|"uses"| Mkt_H
        Mkt_H -->|"calls"| Mkt_D
    end

    %% SellerCenter Module
    subgraph "SellerCenter Module"
        SC_N["SellerCenter - Navigation (SellerCenterScreens.jsx)"]:::module
        SC_V["SellerCenter - View (SCMyIncomeScreen.jsx)"]:::module
        SC_H["SellerCenter - Hooks (useSCMyIncome.js)"]:::module
        %% SellerCenter Data Repositories
        SC_D1["SCAddNewProductsRepositoryImpl.js"]:::module
        SC_D2["SCMyIncomeRepositoryImpl.js"]:::module
        SC_D3["SCProductsRepositoryImpl.js"]:::module
        SC_D4["SCRegistrationRepositoryImpl.js"]:::module
        SC_D5["SellerCenterMyOrdersRepositoryImpl.js"]:::module
        SC_D6["SellerRepositoryImpl.js"]:::module
        SC_N -->|"renders"| SC_V
        SC_V -->|"uses"| SC_H
        SC_H -->|"calls"| SC_D1
        SC_H -->|"calls"| SC_D2
        SC_H -->|"calls"| SC_D3
        SC_H -->|"calls"| SC_D4
        SC_H -->|"calls"| SC_D5
        SC_H -->|"calls"| SC_D6
    end

    %% Platform / Shared Components
    subgraph "Platform / Shared"
        PC1["CustomerInfoContext"]:::platform
        PC2["SellerInfoContext"]:::platform
        PC3["ShopInfoContext"]:::platform
        PL1["AuthLayout"]:::platform
        PL2["MainLayout"]:::platform
        PL3["SellerCenterLayout"]:::platform
        UI1["Header"]:::platform
        UI2["Footer"]:::platform
        GS["Global Styles"]:::platform
        TH["Theme"]:::platform
        NC["Network Configuration"]:::platform
        MM["Modal Manager"]:::platform
        MV["Modal View"]:::platform
    end

    %% Connections from Main Application to Modules and Platform
    MA -->|"loads"| C_N
    MA -->|"loads"| CIAM_N
    MA -->|"loads"| Cust_N
    MA -->|"loads"| Main_V
    MA -->|"loads"| Mkt_N
    MA -->|"loads"| SC_N
    MA -->|"uses shared"| PL1
    MA -->|"uses shared"| PL2
    MA -->|"uses shared"| PL3
    MA -->|"uses shared"| UI1
    MA -->|"uses shared"| UI2
    MA -->|"uses shared"| GS
    MA -->|"uses shared"| TH
    MA -->|"uses shared"| NC
    MA -->|"manages modals via"| MM

    %% Each Module interacts with Platform for Context Providers and Layouts
    C_V -->|"provides context to"| PC1
    CIAM_V -->|"provides context to"| PC1
    Cust_V -->|"accesses context"| PC1
    SC_V -->|"accesses context"| PC2

    %% Click Events
    click MA "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app.jsx"
    click R "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/navigation/router.jsx"
    
    click C_D "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/checkout/data/repository/CheckoutRepositoryImpl.js"
    click C_N "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/checkout/navigation/CheckoutScreens.jsx"
    click C_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/checkout/view/CheckoutScreen.jsx"
    click C_H "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/checkout/view/hooks/useOrder.js"
    
    click CIAM_D "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/ciam/data/repository/CIAMRepositoryImpl.js"
    click CIAM_N "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/ciam/navigation/CIAMScreens.jsx"
    click CIAM_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/ciam/view/Screen/Login.jsx"
    click CIAM_H "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/ciam/view/hook/useLogin.js"
    
    click Cust_D "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/customer/data/repository/CustomerRepositoryImpl.js"
    click Cust_N "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/customer/navigation/CustomerScreens.jsx"
    click Cust_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/customer/view/MyProfile.jsx"
    click Cust_H "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/customer/view/hooks/useCustomer.js"
    
    click Main_D "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/main/data/homeBanner.js"
    click Main_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/main/view/MainScreen.jsx"
    
    click Mkt_N "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/marketing/navigation/MarketingScreens.jsx"
    click Mkt_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/marketing/view/CompetitionScreen.jsx"
    click Mkt_D "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/marketing/view/data/CompetitionRepositoryImp.js"
    click Mkt_H "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/marketing/view/hooks/useCoachDetail.js"
    
    click SC_N "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/navigation/SellerCenterScreens.jsx"
    click SC_V "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/view/screens/SCMyIncomeScreen.jsx"
    click SC_H "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/view/hooks/useSCMyIncome.js"
    click SC_D1 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SCAddNewProductsRepositoryImpl.js"
    click SC_D2 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SCMyIncomeRepositoryImpl.js"
    click SC_D3 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SCProductsRepositoryImpl.js"
    click SC_D4 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SCRegistrationRepositoryImpl.js"
    click SC_D5 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SellerCenterMyOrdersRepositoryImpl.js"
    click SC_D6 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/modules/sellerCenter/data/SellerRepositoryImpl.js"
    
    click PC1 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/app/data/CustomerInfoContext.jsx"
    click PC2 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/app/data/SellerInfoContext.js"
    click PC3 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/app/data/ShopInfoContext.js"
    click PL1 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/Layouts/AuthLayout.jsx"
    click PL2 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/Layouts/MainLayout.jsx"
    click PL3 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/Layouts/SellerCenterLayout.jsx"
    click UI1 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/Header/Header.jsx"
    click UI2 "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/components/Footer/Footer.jsx"
    click GS "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/style/GlobalStyle.js"
    click TH "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/theme/theme.js"
    click NC "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/network/NetworkRepositoryAxiosImpl.js"
    click MM "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/modal/internal/ModalManager.jsx"
    click MV "https://github.com/teojiesern/shuttlestop-fe/blob/main/src/app/platform/modal/internal/ModalView.jsx"
    
    %% Styles
    classDef main fill:#F9CB9C,stroke:#333,stroke-width:2px;
    classDef module fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef platform fill:#A9DFBF,stroke:#333,stroke-width:2px;
```
