# minhkiet05/stationery-store architecture

> Architecture diagram of the GitHub repository minhkiet05/stationery-store, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minhkiet05/stationery-store
- Repository: https://github.com/minhkiet05/stationery-store

## Overview

Stationery-store is a browser-based stationery shop with customer shopping, account, and review flows plus an administration dashboard. Customers enter through routed storefront pages, discover products, inspect details and reviews, manage a cart, and access account and order features; review submission is a distinct post-purchase stage. The frontend’s shared API, query cache, and session scoping form the internal service layer. The README gives little product detail, so capabilities are grounded mainly in the route tree and source index. Backend implementation is not present in the supplied tree.

Main entry points: [`frontend/src/services/api.ts`](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/api.ts) (HTTP API client), [`frontend/src/pages/productDetail/ProductDetail.tsx`](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/productDetail/ProductDetail.tsx) (Product detail), [`frontend/src/App.tsx`](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/App.tsx) (Route application), [`frontend/src/services/storeQueries.ts`](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/storeQueries.ts) (Store query layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Route application<br/>[App.tsx]"]
  node_home["Home catalog<br/>[HomePage.tsx]"]
  node_search["Product search<br/>[SearchPage.tsx]"]
  node_catalogdata["Catalog data<br/>[catalogData.ts]"]
  node_productdetail["Product detail<br/>[ProductDetail.tsx]"]
  node_productcard["Product card<br/>[ProductCard.tsx]"]
  node_recommend["Recommendations"]
  node_policy["Store policies<br/>[Policy.tsx]"]
end

subgraph group_customer["Customer account"]
  node_login["Login and auth<br/>[Login.tsx]"]
  node_profile["Profile and orders<br/>[MyProfile.tsx]"]
  node_reviewpage["Purchase reviews<br/>[ReviewPage.tsx]"]
  node_favorites[("Favorites storage<br/>[favoriteStorage.ts]")]
end

subgraph group_admin["Administration"]
  node_dashboard["Admin dashboard<br/>[ReviewsPage.jsx]"]
end

subgraph group_platform["Frontend services"]
  node_cart["Cart service<br/>[cartService.ts]"]
  node_guestcart[("Guest cart<br/>[guestCart.ts]")]
  node_authservice["Authentication service<br/>[authService.ts]"]
  node_reviewservice["Review service<br/>[reviewService.ts]"]
  node_adminapi["Admin review API<br/>[adminReviewApi.js]"]
  node_dashboardapi["Dashboard API<br/>[dashboardApi.js]"]
  node_api["HTTP API client<br/>[api.ts]"]
  node_queries["Store query layer<br/>[storeQueries.ts]"]
  node_products["Product service<br/>[productService.ts]"]
  node_catalogservice["Catalog service<br/>[catalogService.ts]"]
  node_cache["Query cache<br/>[queryCache.js]"]
  node_session["Session scope<br/>[useSessionScope.js]"]
  node_cartmutation["Cart mutations<br/>[useCartMutation.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

node_shopper(("Shopper"))
node_backend[("Store backend")]

node_shopper -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_productdetail
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_reviewpage
node_app -->|"routes to"| node_policy
node_home -->|"loads catalog"| node_queries
node_home -->|"loads catalog"| node_catalogservice
node_home -->|"uses catalog data"| node_catalogdata
node_home -->|"renders cards"| node_productcard
node_search -->|"searches catalog"| node_catalogservice
node_search -->|"uses catalog data"| node_catalogdata
node_search -->|"uses cache"| node_cache
node_productdetail -->|"loads product data"| node_queries
node_productdetail -->|"loads product"| node_products
node_productdetail -->|"updates cart"| node_cart
node_productdetail -->|"uses mutations"| node_cartmutation
node_productdetail -->|"shows recommendations"| node_recommend
node_productdetail -->|"toggles favorites"| node_favorites
node_productdetail -->|"uses guest cart"| node_guestcart
node_login -->|"authenticates"| node_authservice
node_authservice -->|"merges guest cart"| node_cart
node_authservice -->|"clears guest cart"| node_guestcart
node_profile -->|"reads favorites"| node_favorites
node_reviewpage -->|"submits review"| node_reviewservice
node_dashboard -->|"exports reviews"| node_adminapi
node_dashboard -->|"loads dashboard data"| node_dashboardapi
node_adminapi -->|"sends requests"| node_api
node_dashboardapi -->|"sends requests"| node_api
node_queries -->|"queries products"| node_products
node_queries -->|"queries reviews"| node_reviewservice
node_queries -->|"queries user"| node_authservice
node_queries -->|"keys and times"| node_cache
node_queries -->|"scopes queries"| node_session
node_products -->|"fetches products"| node_api
node_catalogservice -->|"fetches catalog"| node_api
node_reviewservice -->|"sends review requests"| node_api
node_authservice -->|"sends auth requests"| node_api
node_api -->|"HTTP requests"| node_backend
node_api -->|"invalidates data"| node_cache
node_api -->|"reports errors"| node_notifications
node_cart -->|"sends cart requests"| node_api
node_cart -->|"uses guest cart"| node_guestcart
node_favorites -->|"reports changes"| node_notifications

click node_app "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/App.tsx"
click node_home "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/homePage/HomePage.tsx"
click node_search "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/searchPage/SearchPage.tsx"
click node_catalogdata "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/searchPage/catalogData.ts"
click node_productdetail "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/productDetail/ProductDetail.tsx"
click node_productcard "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/components/productCard/ProductCard.tsx"
click node_cart "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/cartService.ts"
click node_guestcart "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/guestCart.ts"
click node_recommend "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/components/recommendations/Recommendations.tsx"
click node_login "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/login/Login.tsx"
click node_authservice "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/authService.ts"
click node_profile "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/myProfile/MyProfile.tsx"
click node_reviewpage "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/review/ReviewPage.tsx"
click node_reviewservice "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/reviewService.ts"
click node_favorites "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/favoriteStorage.ts"
click node_policy "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/policy/Policy.tsx"
click node_dashboard "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/dashboard/ReviewsPage.jsx"
click node_adminapi "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/adminReviewApi.js"
click node_dashboardapi "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/dashboardApi.js"
click node_api "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/api.ts"
click node_queries "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/storeQueries.ts"
click node_products "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/productService.ts"
click node_catalogservice "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/catalogService.ts"
click node_cache "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/queryCache.js"
click node_session "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/useSessionScope.js"
click node_cartmutation "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/useCartMutation.ts"
click node_notifications "https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/notifications.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_search,node_catalogdata,node_productdetail,node_productcard,node_recommend,node_policy toneBlue
class node_login,node_profile,node_reviewpage,node_favorites,node_backend toneAmber
class node_dashboard toneMint
class node_cart,node_guestcart,node_authservice,node_reviewservice,node_adminapi,node_dashboardapi,node_api,node_queries,node_products,node_catalogservice,node_cache,node_session,node_cartmutation,node_notifications toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Route application](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Home catalog](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/homePage/HomePage.tsx): `frontend/src/pages/homePage/HomePage.tsx`
- [Product search](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/searchPage/SearchPage.tsx): `frontend/src/pages/searchPage/SearchPage.tsx`
- [Catalog data](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/searchPage/catalogData.ts): `frontend/src/pages/searchPage/catalogData.ts`
- [Product detail](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/productDetail/ProductDetail.tsx): `frontend/src/pages/productDetail/ProductDetail.tsx`
- [Product card](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/components/productCard/ProductCard.tsx): `frontend/src/components/productCard/ProductCard.tsx`
- [Recommendations](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/components/recommendations/Recommendations.tsx): `frontend/src/components/recommendations/Recommendations.tsx`
- [Store policies](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/policy/Policy.tsx): `frontend/src/pages/policy/Policy.tsx`

### Customer account

- [Login and auth](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/login/Login.tsx): `frontend/src/pages/login/Login.tsx`
- [Profile and orders](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/myProfile/MyProfile.tsx): `frontend/src/pages/myProfile/MyProfile.tsx`
- [Purchase reviews](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/review/ReviewPage.tsx): `frontend/src/pages/review/ReviewPage.tsx`
- [Favorites storage](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/favoriteStorage.ts): `frontend/src/utils/favoriteStorage.ts`

### Administration

- [Admin dashboard](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/pages/dashboard/ReviewsPage.jsx): `frontend/src/pages/dashboard/ReviewsPage.jsx`

### Frontend services

- [Cart service](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/cartService.ts): `frontend/src/services/cartService.ts`
- [Guest cart](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/guestCart.ts): `frontend/src/utils/guestCart.ts`
- [Authentication service](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Review service](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/reviewService.ts): `frontend/src/services/reviewService.ts`
- [Admin review API](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/adminReviewApi.js): `frontend/src/services/adminReviewApi.js`
- [Dashboard API](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/dashboardApi.js): `frontend/src/services/dashboardApi.js`
- [HTTP API client](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Store query layer](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/storeQueries.ts): `frontend/src/services/storeQueries.ts`
- [Product service](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/productService.ts): `frontend/src/services/productService.ts`
- [Catalog service](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/catalogService.ts): `frontend/src/services/catalogService.ts`
- [Query cache](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/queryCache.js): `frontend/src/services/queryCache.js`
- [Session scope](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/useSessionScope.js): `frontend/src/services/useSessionScope.js`
- [Cart mutations](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/services/useCartMutation.ts): `frontend/src/services/useCartMutation.ts`
- [Notifications](https://github.com/minhkiet05/stationery-store/blob/main/frontend/src/utils/notifications.ts): `frontend/src/utils/notifications.ts`

### Other components

- **Shopper**
- **Store backend**

## Connections

- Shopper → Route application: opens (evidence: `frontend/src/App.tsx`)
- Route application → Home catalog: routes to (evidence: `frontend/src/App.tsx`)
- Route application → Product search: routes to (evidence: `frontend/src/App.tsx`)
- Route application → Product detail: routes to (evidence: `frontend/src/App.tsx`)
- Route application → Profile and orders: routes to (evidence: `frontend/src/App.tsx`)
- Route application → Purchase reviews: routes to (evidence: `frontend/src/App.tsx`)
- Route application → Store policies: routes to (evidence: `frontend/src/App.tsx`)
- Home catalog → Store query layer: loads catalog (evidence: `frontend/src/pages/homePage/HomePage.tsx`)
- Home catalog → Catalog service: loads catalog (evidence: `frontend/src/pages/homePage/HomePage.tsx`)
- Home catalog → Catalog data: uses catalog data (evidence: `frontend/src/pages/homePage/HomePage.tsx`)
- Home catalog → Product card: renders cards (evidence: `frontend/src/pages/homePage/HomePage.tsx`)
- Product search → Catalog service: searches catalog (evidence: `frontend/src/pages/searchPage/SearchPage.tsx`)
- Product search → Catalog data: uses catalog data (evidence: `frontend/src/pages/searchPage/SearchPage.tsx`)
- Product search → Query cache: uses cache (evidence: `frontend/src/pages/searchPage/SearchPage.tsx`)
- Product detail → Store query layer: loads product data (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Product service: loads product (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Cart service: updates cart (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Cart mutations: uses mutations (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Recommendations: shows recommendations (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Favorites storage: toggles favorites (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Product detail → Guest cart: uses guest cart (evidence: `frontend/src/pages/productDetail/ProductDetail.tsx`)
- Login and auth → Authentication service: authenticates (evidence: `frontend/src/pages/login/Login.tsx`)
- Authentication service → Cart service: merges guest cart (evidence: `frontend/src/services/authService.ts`)
- Authentication service → Guest cart: clears guest cart (evidence: `frontend/src/services/authService.ts`)
- Profile and orders → Favorites storage: reads favorites (evidence: `frontend/src/utils/favoriteStorage.ts`)
- Purchase reviews → Review service: submits review (evidence: `frontend/src/pages/review/ReviewPage.tsx`)
- Admin dashboard → Admin review API: exports reviews (evidence: `frontend/src/pages/dashboard/ReviewsPage.jsx`)
- Admin dashboard → Dashboard API: loads dashboard data (evidence: `frontend/src/pages/dashboard/ReviewsPage.jsx`)
- Admin review API → HTTP API client: sends requests (evidence: `frontend/src/services/adminReviewApi.js`)
- Dashboard API → HTTP API client: sends requests (evidence: `frontend/src/services/dashboardApi.js`)
- Store query layer → Product service: queries products (evidence: `frontend/src/services/storeQueries.ts`)
- Store query layer → Review service: queries reviews (evidence: `frontend/src/services/storeQueries.ts`)
- Store query layer → Authentication service: queries user (evidence: `frontend/src/services/storeQueries.ts`)
- Store query layer → Query cache: keys and times (evidence: `frontend/src/services/storeQueries.ts`)
- Store query layer → Session scope: scopes queries (evidence: `frontend/src/services/storeQueries.ts`)
- Product service → HTTP API client: fetches products (evidence: `frontend/src/services/productService.ts`)
- Catalog service → HTTP API client: fetches catalog (evidence: `frontend/src/services/catalogService.ts`)
- Review service → HTTP API client: sends review requests (evidence: `frontend/src/services/reviewService.ts`)
- Authentication service → HTTP API client: sends auth requests (evidence: `frontend/src/services/authService.ts`)
- HTTP API client → Store backend: HTTP requests (evidence: `frontend/src/services/api.ts`)
- HTTP API client → Query cache: invalidates data (evidence: `frontend/src/services/api.ts`)
- HTTP API client → Notifications: reports errors (evidence: `frontend/src/services/api.ts`)
- Cart service → HTTP API client: sends cart requests (evidence: `frontend/src/services/cartService.ts`)
- Cart service → Guest cart: uses guest cart (evidence: `frontend/src/services/cartService.ts`)
- Favorites storage → Notifications: reports changes (evidence: `frontend/src/utils/favoriteStorage.ts`)
