# abdelrahmanrefaat20/techmart architecture

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

- Interactive diagram: https://gitdiagram.com/abdelrahmanrefaat20/techmart
- Repository: https://github.com/abdelrahmanrefaat20/techmart

## Overview

TechMart is a Next.js storefront backed by the Route Ecommerce API. The main journey is browsing the catalog, managing a cart and wishlist, signing in, checking out, and reviewing orders; account recovery and product reviews are additional capabilities. The source index and excerpts substantiate shared services, state, authentication, wishlist, and review links. Page-level implementations not sampled are represented by their exact tree paths or enclosing directories, and those links rely on README documentation rather than inspected page code.

Main entry points: [`src/services/apiServices.ts`](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/services/apiServices.ts) (API services), [`src/redux/slices/cartSlice.ts`](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/redux/slices/cartSlice.ts) (Cart state), [`src/components/Review/GetReview.tsx`](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/GetReview.tsx) (Product reviews), [`src/components/Review/CreateReview.tsx`](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/CreateReview.tsx) (Review mutations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront and discovery"]
  node_home["Home discovery<br/>[page.tsx]"]
  node_catalog["Product catalog"]
  node_product_detail["Product details<br/>[page.tsx]"]
  node_category["Category browsing"]
  node_brand["Brand browsing"]
  node_product_views["Product presentation"]
end

subgraph group_identity["Accounts and identity"]
  node_signin["Sign in<br/>[page.tsx]"]
  node_signup["Registration<br/>[page.tsx]"]
  node_auth["Credentials sessions<br/>[authOptions.ts]"]
  node_auth_route["NextAuth route<br/>[route.ts]"]
  node_account["Account management<br/>[page.tsx]"]
  node_recovery["Password recovery"]
end

subgraph group_commerce["Cart and orders"]
  node_cart_view["Cart management<br/>[CartContents.tsx]"]
  node_cart_state["Cart state<br/>[cartSlice.ts]"]
  node_cart_sync["Cart synchronization<br/>[CartSync.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_orders["Order history<br/>[page.tsx]"]
end

subgraph group_engagement["Wishlist and reviews"]
  node_wishlist["Wishlist"]
  node_reviews["Product reviews<br/>[GetReview.tsx]"]
  node_review_forms["Review mutations<br/>[CreateReview.tsx]"]
end

subgraph group_platform["Shared runtime"]
  node_providers["App providers<br/>[MainProvider.tsx]"]
  node_redux["Redux store<br/>[store.ts]"]
  node_api["API services<br/>[apiServices.ts]"]
  node_auth_token["Session token hook<br/>[useAuthToken.ts]"]
  node_product_types["Product and order types<br/>[product.ts]"]
  node_review_types["Review types<br/>[review.ts]"]
end

node_shopper(("Shopper"))
node_api_service{{"Route Ecommerce API"}}

node_shopper -->|"browses"| node_home
node_shopper -->|"browses"| node_catalog
node_shopper -->|"filters by category"| node_category
node_shopper -->|"filters by brand"| node_brand
node_shopper -->|"views details"| node_product_detail
node_home -->|"loads products"| node_api
node_category -->|"loads categories"| node_api
node_brand -->|"loads brands"| node_api
node_product_detail -.->|"shows reviews"| node_reviews
node_shopper -->|"signs in"| node_signin
node_shopper -->|"registers"| node_signup
node_signin -->|"submits credentials"| node_auth_route
node_auth_route -->|"uses options"| node_auth
node_auth -->|"authenticates via"| node_api
node_signup -->|"registers account"| node_api
node_shopper -->|"manages account"| node_account
node_shopper -->|"recovers access"| node_recovery
node_shopper -->|"manages cart"| node_cart_view
node_cart_view -->|"updates state"| node_cart_state
node_cart_state -->|"fetches cart"| node_api
node_cart_sync -->|"synchronizes count"| node_cart_state
node_shopper -->|"submits shipping"| node_checkout
node_checkout -->|"places order"| node_api
node_shopper -->|"views history"| node_orders
node_orders -->|"loads orders"| node_api
node_shopper -->|"saves products"| node_wishlist
node_wishlist -->|"reads and updates"| node_api
node_reviews -->|"renders forms"| node_review_forms
node_review_forms -->|"submits review"| node_api
node_providers -->|"provides context"| node_wishlist
node_providers -->|"provides store"| node_redux
node_redux -->|"registers reducer"| node_cart_state
node_reviews -->|"checks session"| node_auth_token
node_review_forms -->|"checks session"| node_auth_token
node_api -->|"sends requests"| node_api_service
node_product_types -->|"types responses"| node_api
node_review_types -->|"types reviews"| node_api
node_catalog -.->|"presents products"| node_product_views

click node_home "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/page.tsx"
click node_catalog "https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/products"
click node_product_detail "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/products/%5BproductId%5D/page.tsx"
click node_category "https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/categories"
click node_brand "https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/brands"
click node_product_views "https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/components/layout/Product"
click node_signin "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/auth/signin/page.tsx"
click node_signup "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/auth/signup/page.tsx"
click node_auth "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/lib/authOptions.ts"
click node_auth_route "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_account "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/profile/page.tsx"
click node_recovery "https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/auth"
click node_cart_view "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/cart/CartContents.tsx"
click node_cart_state "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/redux/slices/cartSlice.ts"
click node_cart_sync "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/contexts/CartSync.tsx"
click node_checkout "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/checkout/%5BcartId%5D/page.tsx"
click node_orders "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/allorders/page.tsx"
click node_wishlist "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/contexts/WishlistContext.tsx"
click node_reviews "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/GetReview.tsx"
click node_review_forms "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/CreateReview.tsx"
click node_providers "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/providers/MainProvider.tsx"
click node_redux "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/redux/store.ts"
click node_api "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/services/apiServices.ts"
click node_auth_token "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/hooks/useAuthToken.ts"
click node_product_types "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/interfaces/product.ts"
click node_review_types "https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/interfaces/review.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_home,node_catalog,node_product_detail,node_category,node_brand,node_product_views toneBlue
class node_signin,node_signup,node_auth,node_auth_route,node_account,node_recovery toneAmber
class node_cart_view,node_cart_state,node_cart_sync,node_checkout,node_orders,node_api_service toneMint
class node_wishlist,node_reviews,node_review_forms toneRose
class node_providers,node_redux,node_api,node_auth_token,node_product_types,node_review_types,node_shopper toneIndigo
```

## Components

### Storefront and discovery

- [Home discovery](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Product catalog](https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/products): `src/app/(pages)/products`
- [Product details](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/products/%5BproductId%5D/page.tsx): `src/app/(pages)/products/[productId]/page.tsx`
- [Category browsing](https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/categories): `src/app/(pages)/categories`
- [Brand browsing](https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/brands): `src/app/(pages)/brands`
- [Product presentation](https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/components/layout/Product): `src/components/layout/Product`

### Accounts and identity

- [Sign in](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/auth/signin/page.tsx): `src/app/(pages)/auth/signin/page.tsx`
- [Registration](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/auth/signup/page.tsx): `src/app/(pages)/auth/signup/page.tsx`
- [Credentials sessions](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/lib/authOptions.ts): `src/lib/authOptions.ts`
- [NextAuth route](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Account management](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/profile/page.tsx): `src/app/(pages)/profile/page.tsx`
- [Password recovery](https://github.com/abdelrahmanrefaat20/techmart/tree/main/src/app/(pages)/auth): `src/app/(pages)/auth`

### Cart and orders

- [Cart management](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/cart/CartContents.tsx): `src/components/cart/CartContents.tsx`
- [Cart state](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/redux/slices/cartSlice.ts): `src/redux/slices/cartSlice.ts`
- [Cart synchronization](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/contexts/CartSync.tsx): `src/contexts/CartSync.tsx`
- [Checkout](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/checkout/%5BcartId%5D/page.tsx): `src/app/(pages)/checkout/[cartId]/page.tsx`
- [Order history](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/app/(pages)/allorders/page.tsx): `src/app/(pages)/allorders/page.tsx`

### Wishlist and reviews

- [Wishlist](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/contexts/WishlistContext.tsx): `src/contexts/WishlistContext.tsx`
- [Product reviews](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/GetReview.tsx): `src/components/Review/GetReview.tsx`
- [Review mutations](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/components/Review/CreateReview.tsx): `src/components/Review/CreateReview.tsx`

### Shared runtime

- [App providers](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/providers/MainProvider.tsx): `src/providers/MainProvider.tsx`
- [Redux store](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/redux/store.ts): `src/redux/store.ts`
- [API services](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/services/apiServices.ts): `src/services/apiServices.ts`
- [Session token hook](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/hooks/useAuthToken.ts): `src/hooks/useAuthToken.ts`
- [Product and order types](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/interfaces/product.ts): `src/interfaces/product.ts`
- [Review types](https://github.com/abdelrahmanrefaat20/techmart/blob/main/src/interfaces/review.ts): `src/interfaces/review.ts`

### Other components

- **Shopper**
- **Route Ecommerce API**

## Connections

- Shopper → Home discovery: browses (evidence: `README.md`)
- Shopper → Product catalog: browses (evidence: `README.md`)
- Shopper → Category browsing: filters by category (evidence: `README.md`)
- Shopper → Brand browsing: filters by brand (evidence: `README.md`)
- Shopper → Product details: views details (evidence: `README.md`)
- Home discovery → API services: loads products (evidence: `src/app/page.tsx`)
- Category browsing → API services: loads categories (evidence: `src/app/(pages)/categories/page.tsx`)
- Brand browsing → API services: loads brands (evidence: `src/app/(pages)/brands/page.tsx`)
- Product details → Product reviews: shows reviews
- Shopper → Sign in: signs in (evidence: `README.md`)
- Shopper → Registration: registers (evidence: `README.md`)
- Sign in → NextAuth route: submits credentials (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- NextAuth route → Credentials sessions: uses options (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- Credentials sessions → API services: authenticates via (evidence: `src/lib/authOptions.ts`)
- Registration → API services: registers account (evidence: `src/app/(pages)/auth/signup/page.tsx`)
- Shopper → Account management: manages account (evidence: `README.md`)
- Shopper → Password recovery: recovers access (evidence: `README.md`)
- Shopper → Cart management: manages cart (evidence: `README.md`)
- Cart management → Cart state: updates state (evidence: `src/components/cart/CartContents.tsx`)
- Cart state → API services: fetches cart (evidence: `src/redux/slices/cartSlice.ts`)
- Cart synchronization → Cart state: synchronizes count (evidence: `src/contexts/CartSync.tsx`)
- Shopper → Checkout: submits shipping (evidence: `README.md`)
- Checkout → API services: places order (evidence: `src/app/(pages)/checkout/[cartId]/page.tsx`)
- Shopper → Order history: views history (evidence: `README.md`)
- Order history → API services: loads orders (evidence: `src/app/(pages)/allorders/page.tsx`)
- Shopper → Wishlist: saves products (evidence: `README.md`)
- Wishlist → API services: reads and updates (evidence: `src/contexts/WishlistContext.tsx`)
- Product reviews → Review mutations: renders forms (evidence: `src/components/Review/GetReview.tsx`)
- Review mutations → API services: submits review (evidence: `src/components/Review/CreateReview.tsx`)
- App providers → Wishlist: provides context (evidence: `src/providers/MainProvider.tsx`)
- App providers → Redux store: provides store (evidence: `src/providers/MainProvider.tsx`)
- Redux store → Cart state: registers reducer (evidence: `src/redux/store.ts`)
- Product reviews → Session token hook: checks session (evidence: `src/components/Review/GetReview.tsx`)
- Review mutations → Session token hook: checks session (evidence: `src/components/Review/CreateReview.tsx`)
- API services → Route Ecommerce API: sends requests (evidence: `src/services/apiServices.ts`)
- Product and order types → API services: types responses (evidence: `src/services/apiServices.ts`)
- Review types → API services: types reviews (evidence: `src/services/apiServices.ts`)
- Product catalog → Product presentation: presents products
