# samio11/cartify_client architecture

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

- Interactive diagram: https://gitdiagram.com/samio11/cartify_client
- Repository: https://github.com/samio11/cartify_client

## Overview

Cartify is a Next.js e-commerce client. Shoppers browse the storefront and product catalog, authenticate, and use customer cart/account features; administrators manage catalog, users, carts, and payments through protected dashboards. The frontend delegates domain operations to server-side service wrappers that call the backend API. The graph includes documented product areas whose implementation was not sampled; their precise call paths are therefore not asserted.

Main entry points: [`src/app/(DashboardLayout)/admin/dashboard/page.tsx`](https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/admin/dashboard/page.tsx) (Admin Dashboard), [`src/services/Auth/auth.service.ts`](https://github.com/samio11/cartify_client/blob/main/src/services/Auth/auth.service.ts) (Authentication), [`src/components/module/Home`](https://github.com/samio11/cartify_client/tree/main/src/components/module/Home) (Home Sections), [`src/app/(DashboardLayout)/customer/dashboard/page.tsx`](https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/customer/dashboard/page.tsx) (Customer Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home Page<br/>[page.tsx]"]
  node_home_sections["Home Sections"]
  node_product_browse["Product Catalog<br/>[page.tsx]"]
  node_product_detail["Product Details<br/>[ProductDetails.tsx]"]
  node_reviews["Reviews<br/>[review.services.ts]"]
end

subgraph group_identity["Identity"]
  node_login_form["Login Form<br/>[LoginForm.tsx]"]
  node_register_form["Registration Form<br/>[RegisterForm.tsx]"]
  node_user_context["User Context<br/>[UserContext.tsx]"]
  node_route_guard["Role Route Guard<br/>[middleware.ts]"]
end

subgraph group_dashboards["Dashboards"]
  node_admin["Admin Dashboard<br/>[page.tsx]"]
  node_admin_management["Admin Management"]
  node_customer["Customer Dashboard<br/>[page.tsx]"]
  node_customer_cart["Customer Cart<br/>[CartTable.tsx]"]
  node_customer_profile["Customer Profile"]
end

subgraph group_services["API Services"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_product_service["Product Service"]
  node_category_service["Category Service"]
  node_cart_service["Cart Service<br/>[cart.services.ts]"]
  node_payment_service["Payment Service"]
  node_user_service["User Service<br/>[user.services.ts]"]
end

subgraph group_platform["Frontend Platform"]
  node_ui_primitives["UI Primitives<br/>[button.tsx]"]
end

node_shopper(("Shopper"))
node_backend["Backend API"]

node_shopper -->|"browses"| node_home
node_home -->|"renders"| node_home_sections
node_home_sections -->|"loads products"| node_product_service
node_home_sections -->|"loads categories"| node_category_service
node_home_sections -->|"loads reviews"| node_reviews
node_shopper -->|"browses"| node_product_browse
node_product_browse -->|"fetches categories"| node_category_service
node_product_browse -->|"fetches products"| node_product_service
node_shopper -->|"signs in"| node_login_form
node_shopper -->|"registers"| node_register_form
node_login_form -->|"submits credentials"| node_auth_service
node_register_form -->|"registers account"| node_auth_service
node_user_context -->|"loads identity"| node_auth_service
node_route_guard -->|"checks identity"| node_auth_service
node_shopper -->|"uses account"| node_customer
node_customer -->|"reads user state"| node_user_context
node_customer -->|"opens profile editor"| node_customer_profile
node_customer_profile -->|"updates profile"| node_user_service
node_customer -.->|"manages cart"| node_customer_cart
node_customer_cart -.->|"uses cart operations"| node_cart_service
node_shopper -->|"administers"| node_admin
node_admin -->|"loads products"| node_product_service
node_admin -->|"loads payments"| node_payment_service
node_admin -->|"loads users"| node_user_service
node_admin -.->|"manages records"| node_admin_management
node_product_service -->|"requests product data"| node_backend
node_category_service -->|"requests category data"| node_backend
node_auth_service -->|"authenticates"| node_backend
node_reviews -->|"requests reviews"| node_backend
node_user_service -->|"requests user data"| node_backend
node_cart_service -->|"calls API"| node_backend
node_payment_service -->|"calls API"| node_backend

click node_home "https://github.com/samio11/cartify_client/blob/main/src/app/(CommonLayout)/page.tsx"
click node_home_sections "https://github.com/samio11/cartify_client/tree/main/src/components/module/Home"
click node_product_browse "https://github.com/samio11/cartify_client/blob/main/src/app/(CommonLayout)/products/page.tsx"
click node_product_detail "https://github.com/samio11/cartify_client/blob/main/src/components/module/ProductDetails/ProductDetails.tsx"
click node_reviews "https://github.com/samio11/cartify_client/blob/main/src/services/review/review.services.ts"
click node_login_form "https://github.com/samio11/cartify_client/blob/main/src/components/module/Auth/LoginForm.tsx"
click node_register_form "https://github.com/samio11/cartify_client/blob/main/src/components/module/Auth/RegisterForm.tsx"
click node_auth_service "https://github.com/samio11/cartify_client/blob/main/src/services/Auth/auth.service.ts"
click node_user_context "https://github.com/samio11/cartify_client/blob/main/src/context/UserContext.tsx"
click node_route_guard "https://github.com/samio11/cartify_client/blob/main/src/middleware.ts"
click node_admin "https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/admin/dashboard/page.tsx"
click node_admin_management "https://github.com/samio11/cartify_client/tree/main/src/components/module/Dashboard/AdminDashboardComponent"
click node_customer "https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/customer/dashboard/page.tsx"
click node_customer_cart "https://github.com/samio11/cartify_client/blob/main/src/components/module/Dashboard/CustomerDashboardComponent/CartInfo/CartTable.tsx"
click node_customer_profile "https://github.com/samio11/cartify_client/blob/main/src/components/module/Dashboard/CustomerDashboardComponent/EditCustomerInfoModal.tsx"
click node_product_service "https://github.com/samio11/cartify_client/blob/main/src/services/product/product.services.ts"
click node_category_service "https://github.com/samio11/cartify_client/blob/main/src/services/category/category.services.ts"
click node_cart_service "https://github.com/samio11/cartify_client/blob/main/src/services/cart/cart.services.ts"
click node_payment_service "https://github.com/samio11/cartify_client/blob/main/src/services/payment/payment.services.ts"
click node_user_service "https://github.com/samio11/cartify_client/blob/main/src/services/user/user.services.ts"
click node_ui_primitives "https://github.com/samio11/cartify_client/blob/main/src/components/ui/button.tsx"

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_home,node_home_sections,node_product_browse,node_product_detail,node_reviews toneBlue
class node_login_form,node_register_form,node_user_context,node_route_guard toneAmber
class node_admin,node_admin_management,node_customer,node_customer_cart,node_customer_profile,node_backend toneMint
class node_auth_service,node_product_service,node_category_service,node_cart_service,node_payment_service,node_user_service toneRose
class node_ui_primitives,node_shopper toneIndigo
```

## Components

### Storefront

- [Home Page](https://github.com/samio11/cartify_client/blob/main/src/app/(CommonLayout)/page.tsx): `src/app/(CommonLayout)/page.tsx`
- [Home Sections](https://github.com/samio11/cartify_client/tree/main/src/components/module/Home): `src/components/module/Home`
- [Product Catalog](https://github.com/samio11/cartify_client/blob/main/src/app/(CommonLayout)/products/page.tsx): `src/app/(CommonLayout)/products/page.tsx`
- [Product Details](https://github.com/samio11/cartify_client/blob/main/src/components/module/ProductDetails/ProductDetails.tsx): `src/components/module/ProductDetails/ProductDetails.tsx`
- [Reviews](https://github.com/samio11/cartify_client/blob/main/src/services/review/review.services.ts): `src/services/review/review.services.ts`

### Identity

- [Login Form](https://github.com/samio11/cartify_client/blob/main/src/components/module/Auth/LoginForm.tsx): `src/components/module/Auth/LoginForm.tsx`
- [Registration Form](https://github.com/samio11/cartify_client/blob/main/src/components/module/Auth/RegisterForm.tsx): `src/components/module/Auth/RegisterForm.tsx`
- [User Context](https://github.com/samio11/cartify_client/blob/main/src/context/UserContext.tsx): `src/context/UserContext.tsx`
- [Role Route Guard](https://github.com/samio11/cartify_client/blob/main/src/middleware.ts): `src/middleware.ts`

### Dashboards

- [Admin Dashboard](https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/admin/dashboard/page.tsx): `src/app/(DashboardLayout)/admin/dashboard/page.tsx`
- [Admin Management](https://github.com/samio11/cartify_client/tree/main/src/components/module/Dashboard/AdminDashboardComponent): `src/components/module/Dashboard/AdminDashboardComponent`
- [Customer Dashboard](https://github.com/samio11/cartify_client/blob/main/src/app/(DashboardLayout)/customer/dashboard/page.tsx): `src/app/(DashboardLayout)/customer/dashboard/page.tsx`
- [Customer Cart](https://github.com/samio11/cartify_client/blob/main/src/components/module/Dashboard/CustomerDashboardComponent/CartInfo/CartTable.tsx): `src/components/module/Dashboard/CustomerDashboardComponent/CartInfo/CartTable.tsx`
- [Customer Profile](https://github.com/samio11/cartify_client/blob/main/src/components/module/Dashboard/CustomerDashboardComponent/EditCustomerInfoModal.tsx): `src/components/module/Dashboard/CustomerDashboardComponent/EditCustomerInfoModal.tsx`

### API Services

- [Authentication](https://github.com/samio11/cartify_client/blob/main/src/services/Auth/auth.service.ts): `src/services/Auth/auth.service.ts`
- [Product Service](https://github.com/samio11/cartify_client/blob/main/src/services/product/product.services.ts): `src/services/product/product.services.ts`
- [Category Service](https://github.com/samio11/cartify_client/blob/main/src/services/category/category.services.ts): `src/services/category/category.services.ts`
- [Cart Service](https://github.com/samio11/cartify_client/blob/main/src/services/cart/cart.services.ts): `src/services/cart/cart.services.ts`
- [Payment Service](https://github.com/samio11/cartify_client/blob/main/src/services/payment/payment.services.ts): `src/services/payment/payment.services.ts`
- [User Service](https://github.com/samio11/cartify_client/blob/main/src/services/user/user.services.ts): `src/services/user/user.services.ts`

### Frontend Platform

- [UI Primitives](https://github.com/samio11/cartify_client/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`

### Other components

- **Shopper**
- **Backend API**

## Connections

- Shopper → Home Page: browses (evidence: `README.md`)
- Home Page → Home Sections: renders (evidence: `src/app/(CommonLayout)/page.tsx`)
- Home Sections → Product Service: loads products (evidence: `src/components/module/Home/HomeNewProducts.tsx`)
- Home Sections → Category Service: loads categories (evidence: `src/components/module/Home/HomeCategory.tsx`)
- Home Sections → Reviews: loads reviews (evidence: `src/components/module/Home/HomeReview.tsx`)
- Shopper → Product Catalog: browses (evidence: `README.md`)
- Product Catalog → Category Service: fetches categories (evidence: `src/app/(CommonLayout)/products/page.tsx`)
- Product Catalog → Product Service: fetches products (evidence: `src/app/(CommonLayout)/products/page.tsx`)
- Shopper → Login Form: signs in (evidence: `README.md`)
- Shopper → Registration Form: registers (evidence: `README.md`)
- Login Form → Authentication: submits credentials (evidence: `src/components/module/Auth/LoginForm.tsx`)
- Registration Form → Authentication: registers account (evidence: `src/components/module/Auth/RegisterForm.tsx`)
- User Context → Authentication: loads identity (evidence: `src/context/UserContext.tsx`)
- Role Route Guard → Authentication: checks identity (evidence: `src/middleware.ts`)
- Shopper → Customer Dashboard: uses account (evidence: `README.md`)
- Customer Dashboard → User Context: reads user state (evidence: `src/app/(DashboardLayout)/customer/dashboard/page.tsx`)
- Customer Dashboard → Customer Profile: opens profile editor (evidence: `src/app/(DashboardLayout)/customer/dashboard/page.tsx`)
- Customer Profile → User Service: updates profile (evidence: `src/components/module/Dashboard/CustomerDashboardComponent/EditCustomerInfoModal.tsx`)
- Customer Dashboard → Customer Cart: manages cart
- Customer Cart → Cart Service: uses cart operations
- Shopper → Admin Dashboard: administers (evidence: `README.md`)
- Admin Dashboard → Product Service: loads products (evidence: `src/app/(DashboardLayout)/admin/dashboard/page.tsx`)
- Admin Dashboard → Payment Service: loads payments (evidence: `src/app/(DashboardLayout)/admin/dashboard/page.tsx`)
- Admin Dashboard → User Service: loads users (evidence: `src/app/(DashboardLayout)/admin/dashboard/page.tsx`)
- Admin Dashboard → Admin Management: manages records
- Product Service → Backend API: requests product data (evidence: `src/services/product/product.services.ts`)
- Category Service → Backend API: requests category data (evidence: `src/services/category/category.services.ts`)
- Authentication → Backend API: authenticates (evidence: `src/services/Auth/auth.service.ts`)
- Reviews → Backend API: requests reviews (evidence: `src/services/review/review.services.ts`)
- User Service → Backend API: requests user data (evidence: `src/services/user/user.services.ts`)
- Cart Service → Backend API: calls API (evidence: `README.md`)
- Payment Service → Backend API: calls API (evidence: `README.md`)
