How nguyenkhanhquy/internhub-frontend works
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.