# nguyenkhanhquy/internhub-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenkhanhquy/internhub-frontend
- Repository: https://github.com/nguyenkhanhquy/internhub-frontend

## Overview

##### Main Components
- User Interface (UI Layer): This includes all React components, pages, layouts, modals, forms, and navigational elements. Examples:
- Pages (e.g., HomePage, DashboardPage, LoginPage)
- UI Components (e.g., JobCard, SliderBanner, various modals and forms)
- Layouts (e.g., MainLayout, AccountLayout, DataLayout)
- Service & Data Layer: Represent the modules that handle API calls and business logic such as:
- API folder (axiosClient, constants)
- Services (authService, jobPostService, companyService, etc.) that communicate with the backend.
- State Management / Data Store: This includes the Redux store in the “store” directory and the various contexts (e.g., AuthContext) that manage global state.
- Routing & Navigation: The routing logic is handled in src/routes/AppRoutes.jsx, along with navigations in the navigation components.
- Utilities & Configurations: These are helper functions, configurations (e.g., tailwind.config.js, vite.config.js), and context hooks (e.g., useAuth, useWebSocket).

##### Out the Relationships and Interactions
- UI Layer to Data Layer:
- User interactivity in pages and components (such as registering, logging in, applying for jobs) triggers API calls via services.
- The axiosClient in the API folder abstracts HTTP requests to the backend.
- Data Layer to State/Context:
- Services update the Redux store or React contexts, ensuring that state changes propagate across the application.
- For example, AuthProvider and ToastProvider ensure proper global state and notifications.
- Routing:
- AppRoutes manages navigation between pages, ensuring that components display in the right layouts.
- External Services and Environment:
- Environment variables (configured via .env.local) and external libraries like Material UI and Tailwind CSS should be shown as external dependencies.

##### Important Architectural Patterns and Principles
- Separation of Concerns: Note how presentation (UI), business logic (services, contexts), and data fetching (API calls) are kept distinct.
- Component-based Architecture: The structure in “src/components” shows a high degree of modularization with reusable components.
- Data Flow & State Management: Use of React Context alongside a centralized store indicates a mix of global state management approaches.
- Routing and Layouts: Clear separation using different layouts and navigation components for an organized UI.

- Clear labels for each major component, grouping them logically. For example:
- Browser / Client (User accesses via the browser)
- React Application subdivided into: Layouts, Pages, and Components.
- Service/API Layer (network calls through axiosClient and services).
- State Management (store, contexts, hooks).
- External Dependencies (React, Material UI, Tailwind CSS, Vite, deployment on Vercel).
- Data flow from user interactions (UI) to API services (e.g., LoginForm → authService).
- State updates from responses back to UI components.
- Routing flow from one page to another.
- Rectangles for UI components and pages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser("User Browser"):::browser

    subgraph "UI Layer"
        Page_Home("HomePage"):::ui
        Page_Dashboard("DashboardPage"):::ui
        Page_Login("LoginPage"):::ui
        UI_Components("UI Components (JobCard, SliderBanner, Forms, Modals)"):::ui
        Layouts("Layouts (MainLayout, AccountLayout, DataLayout)"):::ui
    end

    subgraph "Service & Data Layer"
        API_A("axiosClient"):::service
        API_C("constants"):::service
        Service_Auth("authService"):::service
        Service_Job("jobPostService"):::service
        Service_Company("companyService"):::service
    end

    subgraph "State Management"
        Redux("Redux Store"):::state
        Context("React Contexts (AuthContext)"):::state
    end

    subgraph "Routing & Navigation"
        Routes("AppRoutes"):::routing
        Navigation("Navigation Components (AccountNavigation, DataNavigation)"):::routing
    end

    subgraph "Utilities & Configurations"
        Utilities("Helper Utilities (dateUtil)"):::util
        Configs("Configurations (config, tailwind.config, vite.config)"):::util
        Hooks("Custom Hooks (useAuth, useWebSocket)"):::util
    end

    subgraph "Providers"
        Providers("State Providers (AuthProvider, ToastProvider)"):::provider
    end

    External("External Dependencies (React, MaterialUI, TailwindCSS, Vite, Vercel)"):::external

    %% Connections
    Browser -->|"renders"| Page_Home
    Browser -->|"renders"| UI_Components
    Browser -->|"renders"| Layouts

    Routes -->|"routes_to"| Page_Home
    Routes -->|"routes_to"| Page_Dashboard
    Routes -->|"routes_to"| Page_Login
    Navigation -->|"navigates_to"| Page_Home
    Navigation -->|"navigates_to"| Page_Dashboard
    Navigation -->|"navigates_to"| Page_Login

    UI_Components -->|"triggers"| Service_Auth
    UI_Components -->|"triggers"| Service_Job
    UI_Components -->|"triggers"| Service_Company

    API_A -->|"used_by"| Service_Auth
    API_A -->|"used_by"| Service_Job
    API_A -->|"used_by"| Service_Company
    API_C -->|"provides_to"| Service_Auth

    Service_Auth -->|"updates"| Redux
    Service_Job -->|"updates"| Redux
    Service_Company -->|"updates"| Redux

    Providers -->|"provides"| Redux
    Providers -->|"provides"| Context

    Hooks -->|"accesses"| Redux
    Hooks -->|"accesses"| Context

    Utilities -->|"assists"| UI_Components
    Configs -->|"configures"| UI_Components

    Redux -->|"updates_view"| UI_Components
    Context -->|"updates_view"| UI_Components

    External -->|"built_with"| UI_Components
    External -->|"built_with"| Providers
    External -->|"built_with"| Redux

%% Click Events
    click Page_Home "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/pages/HomePage/HomePage.jsx"
    click Page_Dashboard "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/pages/DashboardPage/Admin/DashboardPage.jsx"
    click Page_Login "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/pages/LoginPage/LoginPage.jsx"

    click UI_Components "https://github.com/nguyenkhanhquy/internhub-frontend/tree/develop/src/components/job/JobCard"
    click UI_Components "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/components/banners/SliderBanner/SliderBanner.jsx"
    click Layouts "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/layouts/MainLayout/MainLayout.jsx"
    click Layouts "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/layouts/AccountLayout/AccountLayout.jsx"
    click Layouts "https://github.com/nguyenkhanhquy/internhub-frontend/tree/develop/src/layouts/DataLayout"

    click API_A "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/api/axiosClient.js"
    click API_C "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/api/constants.js"
    click Service_Auth "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/services/authService.js"
    click Service_Job "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/services/jobPostService.js"
    click Service_Company "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/services/companyService.js"

    click Redux "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/store/index.js"
    click Context "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/contexts/AuthContext.js"

    click Routes "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/routes/AppRoutes.jsx"
    click Navigation "https://github.com/nguyenkhanhquy/internhub-frontend/tree/develop/src/components/navigations"

    click Utilities "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/utils/dateUtil.js"
    click Configs "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/config/config.js"
    click Hooks "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/hooks/useAuth.js"

    click Providers "https://github.com/nguyenkhanhquy/internhub-frontend/blob/develop/src/providers/AuthProvider.jsx"

%% Styles
    classDef browser fill:#FCE5CD,stroke:#D79B00,stroke-width:2px;
    classDef ui fill:#D9EAD3,stroke:#6AA84F,stroke-width:2px;
    classDef service fill:#FFF2CC,stroke:#BF9000,stroke-width:2px;
    classDef state fill:#D9D2E9,stroke:#674EA7,stroke-width:2px;
    classDef routing fill:#C9DAF8,stroke:#1155CC,stroke-width:2px;
    classDef util fill:#F4CCCC,stroke:#CC0000,stroke-width:2px;
    classDef provider fill:#EAD1DC,stroke:#9900CC,stroke-width:2px;
    classDef external fill:#FCE4EC,stroke:#AD1457,stroke-width:2px;
```
