# scrms-fpt/scrms_customer_fe architecture

> Architecture diagram of the GitHub repository scrms-fpt/scrms_customer_fe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scrms-fpt/scrms_customer_fe
- Repository: https://github.com/scrms-fpt/scrms_customer_fe

## Overview

##### Project Type and Purpose
- This is clearly a React front-end application built with Vite. Although the README is minimal (and focused on bundling with Vite and using official React plugins for fast refresh), the extensive file tree reveals that this is not just a “Hello World” project.
- The app appears to be designed for a sports or coaching platform—with dedicated components and pages for courts, coaching sessions, bookings, chat systems, and user profile management. In addition, there is a well-structured API directory (src/API) that indicates that the front end communicates with one or more backend services.

##### File Structure and Main Components
- Top-level directories such as “public” and “src” are standard for a React project.
- Within “src” you have distinct areas:
– API: Contains various modules (ChatApi, CoachApi, PaymentApi, etc.), suggesting a separation of concerns where all backend communications are abstracted.
– Components: Organized into several domain-specific folders (e.g., Chat, CoachComponents, CourtComponents, UserPage) that represent the different UI sections and their functionalities.
– Pages: It further divides views (e.g., CoachView, CourtOwnerView, UserView, Error views) which implies routing is being used to manage different application states.
– Redux and Context: With state management done using redux slices (chatSlice.js, reviewSlice.js, userSlice.js) and a ChatContext, the app clearly segregates state handling from presentation.
– Routes: The routing configuration (CoachRoutes, UserRoutes, etc.) clearly maps out how users navigate between these different sections.
- Other supportive directories include hooks, utils, theme and styles—indicating clean separations between styling, business logic, and configuration.

## Diagram (Mermaid)

```mermaid
graph TD
    %% UI Components Layer
    subgraph "UI Components"
        UI_Chat["Chat Components"]:::ui
        UI_CoachComponents["Coach Components"]:::ui
        UI_CoachPage["Coach Page"]:::ui
        UI_CourtComponents["Court Components"]:::ui
        UI_CourtDetails["Court Details View"]:::ui
        UI_UserPage["User Page"]:::ui
        UI_UserTransaction["User Transaction View"]:::ui
    end

    %% View Layer (Pages & Routing)
    subgraph "View Layer"
        Pages["Pages"]:::routing
        Routes["Routing"]:::routing
    end

    %% API Integration Layer
    API_Integ["API Integration Layer"]:::api

    %% State Management Layer
    subgraph "State Management"
        Redux["Redux Store & Slices"]:::state
        ChatContext["Chat Context"]:::state
    end

    %% Utility & Configuration
    subgraph "Utility & Configuration"
        Hooks["Hooks"]:::utility
        Utils["Utility Functions"]:::utility
    end

    %% Styling & Theming
    subgraph "Styling & Theming"
        Theme["Theme Files"]:::styling
        Styles["Custom Styles"]:::styling
    end

    %% Connections: UI Components to View Layer
    UI_Chat        -->|"navigates"| Pages
    UI_CoachComponents -->|"navigates"| Pages
    UI_CoachPage   -->|"navigates"| Pages
    UI_CourtComponents -->|"navigates"| Pages
    UI_CourtDetails   -->|"navigates"| Pages
    UI_UserPage    -->|"navigates"| Pages
    UI_UserTransaction -->|"navigates"| Pages

    %% View Layer internal flow
    Pages          -->|"routes"| Routes
    Routes         -->|"calls"| API_Integ

    %% API to State Management
    API_Integ      -->|"updates"| Redux
    API_Integ      -->|"updates"| ChatContext

    %% State update back to UI (illustrative for one component)
    Redux          -->|"stateUpdate"| UI_Chat
    ChatContext    -->|"realTimeUpdate"| UI_Chat

    %% Utility and Styling support flow into View Layer
    Hooks          -->|"supports"| Pages
    Utils          -->|"supports"| Pages
    Theme          -->|"styles"| Pages
    Styles         -->|"styles"| Pages

    %% Click Events
    click UI_Chat "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/Chat"
    click UI_CoachComponents "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/CoachComponents"
    click UI_CoachPage "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/CoachPage"
    click UI_CourtComponents "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/CourtComponents"
    click UI_CourtDetails "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/CourtDetailsView"
    click UI_UserPage "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/UserPage"
    click UI_UserTransaction "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/components/UserTransactionView"
    click Pages "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/pages"
    click Routes "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/routes"
    click API_Integ "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/API"
    click Redux "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/redux"
    click ChatContext "https://github.com/scrms-fpt/scrms_customer_fe/blob/main/src/context/ChatContext.jsx"
    click Hooks "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/hooks"
    click Utils "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/utils"
    click Theme "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/theme"
    click Styles "https://github.com/scrms-fpt/scrms_customer_fe/tree/main/src/styles"

    %% Styles
    classDef ui fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px,color:#0D47A1;
    classDef routing fill:#FFF59D,stroke:#F9A825,stroke-width:2px,color:#F57F17;
    classDef api fill:#FFAB91,stroke:#BF360C,stroke-width:2px,color:#BF360C;
    classDef state fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px,color:#1B5E20;
    classDef utility fill:#D1C4E9,stroke:#512DA8,stroke-width:2px,color:#311B92;
    classDef styling fill:#F8BBD0,stroke:#880E4F,stroke-width:2px,color:#880E4F;
```
