# nhtbao101/fe-accesories-store architecture

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

- Interactive diagram: https://gitdiagram.com/nhtbao101/fe-accesories-store
- Repository: https://github.com/nhtbao101/fe-accesories-store

## Overview

- Frontend/UI Layer:
– Next.js Pages: The “app” directory (e.g., app/page.tsx, app/products, app/account, app/manage) represents various frontend routes including customer pages, admin pages, product details, and checkout areas.
– React Components: Under directories like “src/components” and “src/layout”, these provide reusability (e.g., banners, breadcrumbs, loaders, modals, headers/footers) and are driven by Next.js rendering.
- State Management & Core Services:
– Redux: Files under “src/redux” (store.ts, feature slices for auth, product, cart, etc.) show the separation of state management and API interaction logic.
– Core/Service Modules: “src/core/service” and “src/config” contain API services, authentication logic, and endpoint definitions.
- Styling & Assets:
– CSS/SCSS: Directories like “css” and “src/assets/scss” hold styling using multiple frameworks and perhaps Tailwind CSS (noted by tailwind.config.ts) for layout and theming.
– Static Assets: “src/assets” holds images, fonts, and SVGs that are used across the UI.
- Third‑Party and Configuration Elements:
– Next.js configuration (next.config.ts, tsconfig.json), environment files, and GitHub workflows for CI/CD.
– Deployment artifacts (README’s mention of Vercel) and build scripts.

##### Relationships and Interactions
- Flow from the browser (user) to the Next.js pages and their nested components.
- That pages call React components, which in turn connect with Redux (via hooks) to fetch/update data.
- Styling and assets as cross‑cutting concerns that feed into every UI component.
- Configuration, deployment, and CI pipelines that continuously integrate, test, and deploy the application.

##### Architectural Patterns and Principles
- Modular Design: Each page and component is isolated in its own folder structure, promoting reusability.
- Separation of Concerns (SoC): Clear division among presentation (React components), state management (Redux), and service layers (API/auth services).
- Use of Hooks: Note the custom hooks (e.g., use-auth-check, use-cart-info) that abstract business logic.

##### Putting It All Together
- Break out subcomponents that each page utilizes (e.g., headers, banners, product items).
- UI components with a middleware layer that uses custom hooks and Redux (with slices for authentication, cart, product, etc.).
- Finally, illustrate the backend/API service layer (even if it’s internal or serverless functions) that connects with external APIs or database configurations indicated in “src/config” and “src/core/service”.
- Static assets and styling that “dress” the entire UI.

## Diagram (Mermaid)

```mermaid
graph TD
  subgraph "Frontend/UI Layer"
    A["User Browser"]:::frontend
    B["Next.js Pages"]:::frontend
    C["UI Components"]:::frontend
    D["Layouts"]:::frontend
    L["Custom Hooks"]:::state
    H["Global CSS"]:::styling
    I["SCSS Assets"]:::styling
    J["Tailwind Config"]:::styling
    K["Static Assets"]:::styling
  end

  subgraph "Application Logic & State"
    E["Redux Store & Slices"]:::state
    F["API Service Modules"]:::service
    G["Configurations"]:::service
  end

  subgraph "Infrastructure & Deployment"
    M["CI/CD Workflows"]:::infra
    N["Next.js & TSConfig"]:::infra
  end

  A -->|"access"| B
  B -->|"renders"| C
  B -->|"renders"| D
  C -->|"interacts"| E
  D -->|"interacts"| E
  E -->|"calls"| F
  E -->|"reads"| G
  L -->|"usedBy"| C
  L -->|"usedBy"| D
  H ---|"styles"| B
  I ---|"styles"| C
  J ---|"styles"| C
  K ---|"assets"| D
  M -->|"deploys"| B
  N -->|"configures"| B

  classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
  classDef state fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
  classDef service fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
  classDef styling fill:#F5CBA7,stroke:#AF601A,stroke-width:2px;
  classDef infra fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;

  click B "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/app"
  click C "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/components"
  click D "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/layout"
  click E "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/redux"
  click F "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/core/service"
  click G "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/config"
  click H "https://github.com/nhtbao101/fe-accesories-store/tree/main/css"
  click I "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/assets/scss"
  click J "https://github.com/nhtbao101/fe-accesories-store/blob/main/tailwind.config.ts"
  click K "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/assets"
  click L "https://github.com/nhtbao101/fe-accesories-store/tree/main/src/hooks"
  click M "https://github.com/nhtbao101/fe-accesories-store/tree/main/.github/workflows"
  click N "https://github.com/nhtbao101/fe-accesories-store/blob/main/next.config.ts"
```
