# yaramohammed20/techmart-e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/yaramohammed20/techmart-e-commerce
- Repository: https://github.com/yaramohammed20/techmart-e-commerce

## Overview

TechMart is a Next.js storefront backed by the RouteMisr commerce API. Shoppers browse catalogs and product details, add items to cart or wishlist, then review the cart and proceed through checkout; authenticated users can also manage profiles, addresses, and order history. The graph highlights these domain stages and the API client as the internal integration layer. Checkout and order-history capabilities are included as documented or present in the tree; their detailed calls are not shown in the excerpts.

Main entry points: [`src/lib/api.ts`](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/lib/api.ts) (Commerce API client), [`src/components/products/ProductCard.tsx`](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/products/ProductCard.tsx) (Product card), [`src/app/(pages)/products/page.tsx`](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/products/page.tsx) (Catalog browsing), [`src/app/(pages)/cart/page.tsx`](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/cart/page.tsx) (Cart management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home<br/>[page.tsx]"]
  node_catalog["Catalog browsing<br/>[page.tsx]"]
  node_category["Categories<br/>[page.tsx]"]
  node_category_detail["Category detail<br/>[page.tsx]"]
  node_subcategory["Subcategory<br/>[page.tsx]"]
  node_brands["Brands<br/>[page.tsx]"]
  node_brand_detail["Brand detail<br/>[page.tsx]"]
  node_product_detail["Product detail<br/>[page.tsx]"]
  node_product_card["Product card<br/>[ProductCard.tsx]"]
  node_loading["Loading indicator<br/>[LoadingSpinner.tsx]"]
  node_rating["Rating display<br/>[rating.tsx]"]
  node_currency["Price formatting<br/>[currency.ts]"]
  node_button["Button UI<br/>[button.tsx]"]
  node_separator["Separator UI<br/>[separator.tsx]"]
  node_navbar["Navigation<br/>[navbar.tsx]"]
  node_footer["Footer<br/>[footer.tsx]"]
end

subgraph group_shopping["Shopping"]
  node_cart["Cart management<br/>[page.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_wishlist["Wishlist<br/>[page.tsx]"]
  node_wishlist_button["Wishlist control<br/>[WishlistButton.tsx]"]
end

subgraph group_account["Account"]
  node_signin["Sign in<br/>[page.tsx]"]
  node_register["Registration<br/>[page.tsx]"]
  node_auth_route["Auth route<br/>[route.ts]"]
  node_profile["Profile and addresses<br/>[page.tsx]"]
  node_orders["Order history<br/>[api.ts]"]
end

subgraph group_integration["Integration"]
  node_api["Commerce API client<br/>[api.ts]"]
end

node_shopper(("Shopper"))
node_commerce_service{{"RouteMisr API"}}

node_shopper -.->|"opens"| node_home
node_shopper -.->|"browses"| node_catalog
node_shopper -.->|"browses"| node_category
node_shopper -.->|"browses"| node_brands
node_catalog -->|"fetches listings"| node_api
node_category -->|"loads categories"| node_api
node_category_detail -->|"loads category"| node_api
node_subcategory -->|"loads products"| node_api
node_brands -->|"loads brands"| node_api
node_brand_detail -->|"loads products"| node_api
node_catalog -->|"renders"| node_product_card
node_product_card -->|"adds cart item"| node_api
node_product_card -->|"adds wishlist item"| node_api
node_product_card -->|"renders stars"| node_rating
node_product_card -->|"formats price"| node_currency
node_product_card -->|"uses"| node_button
node_product_detail -->|"loads product"| node_api
node_cart -->|"reads and updates"| node_api
node_cart -->|"formats totals"| node_currency
node_cart -->|"links to"| node_checkout
node_checkout -->|"starts checkout"| node_api
node_wishlist -->|"loads wishlist"| node_api
node_wishlist_button -->|"updates wishlist"| node_api
node_signin -->|"authenticates"| node_api
node_register -.->|"registers account"| node_api
node_shopper -.->|"signs in"| node_signin
node_shopper -.->|"registers"| node_register
node_auth_route -.->|"auth integration"| node_commerce_service
node_profile -->|"manages profile"| node_api
node_orders -.->|"reads orders"| node_commerce_service
node_api -->|"sends requests"| node_commerce_service
node_catalog -->|"shows while loading"| node_loading
node_product_detail -->|"shows while loading"| node_loading
node_wishlist -->|"shows while loading"| node_loading
node_navbar -.->|"utility import"| node_api
node_shopper -.->|"manages account"| node_profile

click node_home "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/page.tsx"
click node_catalog "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/products/page.tsx"
click node_category "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/categories/page.tsx"
click node_category_detail "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/categories/%5Bid%5D/page.tsx"
click node_subcategory "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/subcategory/%5Bid%5D/page.tsx"
click node_brands "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/brands/page.tsx"
click node_brand_detail "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/brands/%5Bid%5D/page.tsx"
click node_product_detail "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/products/%5Bid%5D/page.tsx"
click node_product_card "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/products/ProductCard.tsx"
click node_cart "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/cart/page.tsx"
click node_checkout "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/checkout/page.tsx"
click node_wishlist "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/wishlist/page.tsx"
click node_wishlist_button "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/WishlistButton.tsx"
click node_signin "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/auth/signin/page.tsx"
click node_register "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/auth/register/page.tsx"
click node_auth_route "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_profile "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/user/page.tsx"
click node_api "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/lib/api.ts"
click node_orders "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/lib/api.ts"
click node_loading "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/shared/LoadingSpinner.tsx"
click node_rating "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/helpers/rating.tsx"
click node_currency "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/helpers/currency.ts"
click node_button "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/button.tsx"
click node_separator "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/separator.tsx"
click node_navbar "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/layout/navbar.tsx"
click node_footer "https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/layout/footer.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_catalog,node_category,node_category_detail,node_subcategory,node_brands,node_brand_detail,node_product_detail,node_product_card,node_loading,node_rating,node_currency,node_button,node_separator,node_navbar,node_footer toneBlue
class node_cart,node_checkout,node_wishlist,node_wishlist_button toneAmber
class node_signin,node_register,node_auth_route,node_profile,node_orders,node_commerce_service toneMint
class node_api toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Home](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Catalog browsing](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/products/page.tsx): `src/app/(pages)/products/page.tsx`
- [Categories](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/categories/page.tsx): `src/app/(pages)/categories/page.tsx`
- [Category detail](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/categories/%5Bid%5D/page.tsx): `src/app/(pages)/categories/[id]/page.tsx`
- [Subcategory](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/subcategory/%5Bid%5D/page.tsx): `src/app/(pages)/subcategory/[id]/page.tsx`
- [Brands](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/brands/page.tsx): `src/app/(pages)/brands/page.tsx`
- [Brand detail](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/brands/%5Bid%5D/page.tsx): `src/app/(pages)/brands/[id]/page.tsx`
- [Product detail](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/products/%5Bid%5D/page.tsx): `src/app/(pages)/products/[id]/page.tsx`
- [Product card](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/products/ProductCard.tsx): `src/components/products/ProductCard.tsx`
- [Loading indicator](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/shared/LoadingSpinner.tsx): `src/components/shared/LoadingSpinner.tsx`
- [Rating display](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/helpers/rating.tsx): `src/helpers/rating.tsx`
- [Price formatting](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/helpers/currency.ts): `src/helpers/currency.ts`
- [Button UI](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Separator UI](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/separator.tsx): `src/components/ui/separator.tsx`
- [Navigation](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/layout/navbar.tsx): `src/components/layout/navbar.tsx`
- [Footer](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/layout/footer.tsx): `src/components/layout/footer.tsx`

### Shopping

- [Cart management](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/cart/page.tsx): `src/app/(pages)/cart/page.tsx`
- [Checkout](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/checkout/page.tsx): `src/app/(pages)/checkout/page.tsx`
- [Wishlist](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/(pages)/wishlist/page.tsx): `src/app/(pages)/wishlist/page.tsx`
- [Wishlist control](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/components/ui/WishlistButton.tsx): `src/components/ui/WishlistButton.tsx`

### Account

- [Sign in](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/auth/signin/page.tsx): `src/app/auth/signin/page.tsx`
- [Registration](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/auth/register/page.tsx): `src/app/auth/register/page.tsx`
- [Auth route](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Profile and addresses](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/app/user/page.tsx): `src/app/user/page.tsx`
- [Order history](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Integration

- [Commerce API client](https://github.com/yaramohammed20/techmart-e-commerce/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Other components

- **Shopper**
- **RouteMisr API**

## Connections

- Shopper → Home: opens
- Shopper → Catalog browsing: browses
- Shopper → Categories: browses
- Shopper → Brands: browses (evidence: `src/app/(pages)/brands/page.tsx`)
- Catalog browsing → Commerce API client: fetches listings (evidence: `src/app/(pages)/products/page.tsx`)
- Categories → Commerce API client: loads categories (evidence: `src/app/(pages)/categories/page.tsx`)
- Category detail → Commerce API client: loads category (evidence: `src/app/(pages)/categories/[id]/page.tsx`)
- Subcategory → Commerce API client: loads products (evidence: `src/app/(pages)/subcategory/[id]/page.tsx`)
- Brands → Commerce API client: loads brands (evidence: `src/app/(pages)/brands/page.tsx`)
- Brand detail → Commerce API client: loads products (evidence: `src/app/(pages)/brands/[id]/page.tsx`)
- Catalog browsing → Product card: renders (evidence: `src/app/(pages)/products/page.tsx`)
- Product card → Commerce API client: adds cart item (evidence: `src/components/products/ProductCard.tsx`)
- Product card → Commerce API client: adds wishlist item (evidence: `src/components/products/ProductCard.tsx`)
- Product card → Rating display: renders stars (evidence: `src/components/products/ProductCard.tsx`)
- Product card → Price formatting: formats price (evidence: `src/components/products/ProductCard.tsx`)
- Product card → Button UI: uses (evidence: `src/components/products/ProductCard.tsx`)
- Product detail → Commerce API client: loads product (evidence: `src/app/(pages)/products/[id]/page.tsx`)
- Cart management → Commerce API client: reads and updates (evidence: `src/app/(pages)/cart/page.tsx`)
- Cart management → Price formatting: formats totals (evidence: `src/app/(pages)/cart/page.tsx`)
- Cart management → Checkout: links to (evidence: `src/app/(pages)/cart/page.tsx`)
- Checkout → Commerce API client: starts checkout (evidence: `src/app/(pages)/checkout/page.tsx`)
- Wishlist → Commerce API client: loads wishlist (evidence: `src/app/(pages)/wishlist/page.tsx`)
- Wishlist control → Commerce API client: updates wishlist (evidence: `src/components/ui/WishlistButton.tsx`)
- Sign in → Commerce API client: authenticates (evidence: `src/lib/api.ts`)
- Registration → Commerce API client: registers account
- Shopper → Sign in: signs in
- Shopper → Registration: registers
- Auth route → RouteMisr API: auth integration
- Profile and addresses → Commerce API client: manages profile (evidence: `src/app/user/page.tsx`)
- Order history → RouteMisr API: reads orders
- Commerce API client → RouteMisr API: sends requests (evidence: `src/lib/api.ts`)
- Catalog browsing → Loading indicator: shows while loading (evidence: `src/app/(pages)/products/page.tsx`)
- Product detail → Loading indicator: shows while loading (evidence: `src/app/(pages)/products/[id]/page.tsx`)
- Wishlist → Loading indicator: shows while loading (evidence: `src/app/(pages)/wishlist/page.tsx`)
- Navigation → Commerce API client: utility import
- Shopper → Profile and addresses: manages account
