# vutan/fe_project architecture

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

- Interactive diagram: https://gitdiagram.com/vutan/fe_project
- Repository: https://github.com/vutan/fe_project

## Overview

##### Main components and their roles
- UI/Presentation Layer: Represented by the many React components in the "src/component" folder (e.g., Header, Footer, Home, Product, Cart, Login, SignUp, News, Profile, Shop). These encapsulate the view logic of the application.
- State Management Layer: The "src/redux" folder contains store configuration and various reducers managing cart, favorite, and user states. This is central to the application’s data flow.
- Service Layer: The "src/service" folder shows services for handling API interactions (NewsService, ProductService, UserService) along with a customized Axios instance for HTTP requests.
- Data Models: Defined in "src/models" (e.g., News.modal.ts, Product.modal.ts, User.modal.ts), these files represent the structure of data handled in the application.
- Internationalization (i18n): The "src/i18n" and "src/locales" folders are dedicated to managing translations, indicating an architecture designed for multilingual support.
- Static Assets: The "public" folder holds HTML, media assets (like videos), and manifest files, and serves as the point of entry (index.html) for the application.

##### Relationships and interactions
- Internationalization is used across UI components to render locale-specific text, so indicate that the i18n module injects localization data to these components.
- Data models underpin data validation and structure across services and Redux reducers, so highlight these as common data contracts.

##### Architectural patterns and principles
- Component-Based Architecture: Each UI component (like Header, Footer, etc.) is modular and self-contained.
- Unidirectional Data Flow: With Redux as the central state manager, the flow of data from components (via dispatched actions) to reducers and back to the UI is unidirectional.
- Service Abstraction: The separation of concerns with service modules handling backend communication, thereby abstracting HTTP logic from presentation.
- Internationalization: Using a dedicated i18n setup to separate translation data from UI components.
- Separation of Assets: The clear separation of static files (in public) from application logic (in src).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Application"
        %% UI Components Subgraph
        subgraph "UI Components"
            UI_Folder["UI Components"]:::ui
            UI_Header["Header"]:::ui
            UI_Footer["Footer"]:::ui
            UI_Home["Home"]:::ui
            UI_Product["Product"]:::ui
            UI_Cart["Cart"]:::ui
            UI_Shop["Shop"]:::ui
            UI_Login["Login"]:::ui
            UI_SignUp["SignUp"]:::ui
            UI_Profile["Profile"]:::ui
            UI_News["News"]:::ui
        end

        %% State Management Subgraph
        subgraph "State Management"
            ReduxStore["Redux Store"]:::redux
        end

        %% Service Layer Subgraph
        subgraph "Service Layer"
            API_Services["API Services"]:::service
            Service_Axios["Axios Instance"]:::service
        end

        %% Data Models Subgraph
        subgraph "Data Models"
            DataModels["Data Models"]:::models
        end

        %% Internationalization Subgraph
        subgraph "Internationalization"
            I18nSetup["i18n Setup"]:::i18n
            LocaleFiles["Locale Files"]:::i18n
        end

        %% Static Assets
        StaticAssets["Static Assets"]:::assets
    end

    %% Relationships
    UI_Folder -->|"dispatches"| ReduxStore
    ReduxStore -->|"calls"| API_Services
    API_Services -->|"returns"| ReduxStore
    I18nSetup -->|"provides"| UI_Folder
    LocaleFiles -->|"data"| I18nSetup
    DataModels -->|"definesContract"| API_Services
    DataModels -->|"definesContract"| ReduxStore
    StaticAssets -->|"loads"| UI_Folder
    API_Services -->|"uses"| Service_Axios

    %% Click Events
    click UI_Folder "https://github.com/vutan/fe_project/tree/master/src/component"
    click ReduxStore "https://github.com/vutan/fe_project/tree/master/src/redux"
    click API_Services "https://github.com/vutan/fe_project/tree/master/src/service"
    click DataModels "https://github.com/vutan/fe_project/tree/master/src/models"
    click I18nSetup "https://github.com/vutan/fe_project/tree/master/src/i18n"
    click LocaleFiles "https://github.com/vutan/fe_project/tree/master/src/locales"
    click StaticAssets "https://github.com/vutan/fe_project/tree/master/public"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef redux fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef service fill:#F5CBA7,stroke:#C0392B,stroke-width:2px;
    classDef models fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef i18n fill:#A9DFBF,stroke:#239B56,stroke-width:2px;
    classDef assets fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
