# abutalha2937/xshop.pk-ecommerce-full-stack-website architecture

> Architecture diagram of the GitHub repository abutalha2937/xshop.pk-ecommerce-full-stack-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abutalha2937/xshop.pk-ecommerce-full-stack-website
- Repository: https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website

## Overview

XSHOP.PK is a database-driven Pakistani ecommerce platform. Shoppers discover catalog items, manage a guest or account cart, complete a server-priced COD checkout, and then view confirmation or track an order; customers can also manage accounts and wishlists. Separate product areas cover support and CMS content, while a protected admin console manages catalog, orders, inventory, and store settings. Prisma/SQLite is the shared persistence layer. The graph reflects README-described capabilities; some unsampled page and action wiring is not independently verified.

Main entry points: [`src/features/checkout/actions.ts`](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/checkout/actions.ts) (Checkout), [`src/features/admin/crud.ts`](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/admin/crud.ts) (Admin Mutations), [`src/lib/cart.ts`](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/cart.ts) (Cart), [`src/app/shop/page.tsx`](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/shop/page.tsx) (Browse & Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_pages["Browse &amp; Search<br/>[page.tsx]"]
  node_product_detail["Product Detail<br/>[page.tsx]"]
  node_product_ui["Product UI<br/>[PurchasePanel.tsx]"]
  node_customer_account["Customer Account<br/>[page.tsx]"]
  node_reviews["Reviews<br/>[actions.ts]"]
  node_search_api["Predictive Search<br/>[route.ts]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Cart<br/>[cart.ts]"]
  node_cart_api["Cart Endpoint<br/>[route.ts]"]
  node_checkout["Checkout<br/>[actions.ts]"]
  node_checkout_ui["Checkout Form<br/>[CheckoutForm.tsx]"]
  node_order_result["Confirmation &amp; Tracking<br/>[page.tsx]"]
  node_wishlist["Wishlist<br/>[actions.ts]"]
end

subgraph group_operations["Admin Operations"]
  node_admin["Admin Console<br/>[page.tsx]"]
  node_admin_actions["Admin Mutations<br/>[crud.ts]"]
  node_admin_auth["Admin Auth<br/>[auth.ts]"]
end

subgraph group_content_support["Content &amp; Support"]
  node_support["Support &amp; Returns<br/>[page.tsx]"]
  node_corporate["Corporate Quotes<br/>[CorporateForm.tsx]"]
  node_content["Store Content<br/>[page.tsx]"]
end

subgraph group_internal["Shared Services"]
  node_auth_actions["Customer Auth<br/>[actions.ts]"]
  node_database[("Prisma Database")]
  node_settings["Store Settings<br/>[settings.ts]"]
  node_validation["Input Validation<br/>[validation.ts]"]
end

node_shopper(("Shopper"))
node_visitor(("Site Visitor"))

node_shopper -->|"browses"| node_storefront_pages
node_storefront_pages -->|"opens product"| node_product_detail
node_product_detail -->|"renders purchase"| node_product_ui
node_product_ui -->|"adds items"| node_cart
node_shopper -->|"manages cart"| node_cart
node_cart_api -->|"reads cart"| node_cart
node_cart -->|"reads and writes"| node_database
node_shopper -->|"submits order"| node_checkout_ui
node_checkout_ui -->|"invokes checkout"| node_checkout
node_checkout -->|"prices and persists"| node_database
node_checkout -->|"reads shipping rules"| node_settings
node_checkout -->|"validates input"| node_validation
node_checkout -->|"creates order"| node_order_result
node_shopper -->|"manages account"| node_customer_account
node_customer_account -->|"updates profile"| node_auth_actions
node_auth_actions -->|"reads and writes"| node_database
node_product_detail -->|"offers review"| node_reviews
node_shopper -->|"requests support"| node_support
node_shopper -->|"requests quote"| node_corporate
node_visitor -->|"queries catalog"| node_search_api
node_shopper -->|"manages wishlist"| node_wishlist
node_admin -->|"authenticates"| node_admin_auth
node_admin -->|"manages store"| node_admin_actions
node_admin_actions -->|"updates records"| node_database
node_admin_actions -->|"requires authorization"| node_admin_auth
node_admin_actions -->|"maintains content"| node_content
node_storefront_pages -->|"reads catalog"| node_database
node_content -->|"reads content"| node_database

click node_storefront_pages "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/shop/page.tsx"
click node_product_detail "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/product/%5Bslug%5D/page.tsx"
click node_product_ui "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/products/PurchasePanel.tsx"
click node_customer_account "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/account/page.tsx"
click node_cart "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/cart.ts"
click node_cart_api "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/api/cart/route.ts"
click node_checkout "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/checkout/actions.ts"
click node_checkout_ui "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/checkout/CheckoutForm.tsx"
click node_order_result "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/track-order/page.tsx"
click node_wishlist "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/wishlist/actions.ts"
click node_reviews "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/reviews/actions.ts"
click node_auth_actions "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/auth/actions.ts"
click node_support "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/support/page.tsx"
click node_corporate "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/support/CorporateForm.tsx"
click node_content "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/blog/page.tsx"
click node_admin "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/admin/(panel)/page.tsx"
click node_admin_actions "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/admin/crud.ts"
click node_admin_auth "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/admin/auth.ts"
click node_settings "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/settings.ts"
click node_validation "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/validation.ts"
click node_search_api "https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/api/search/route.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_storefront_pages,node_product_detail,node_product_ui,node_customer_account,node_reviews,node_search_api toneBlue
class node_cart,node_cart_api,node_checkout,node_checkout_ui,node_order_result,node_wishlist toneAmber
class node_admin,node_admin_actions,node_admin_auth toneMint
class node_support,node_corporate,node_content toneRose
class node_auth_actions,node_database,node_settings,node_validation,node_shopper,node_visitor toneIndigo
```

## Components

### Storefront

- [Browse & Search](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/shop/page.tsx): `src/app/shop/page.tsx`
- [Product Detail](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/product/%5Bslug%5D/page.tsx): `src/app/product/[slug]/page.tsx`
- [Product UI](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/products/PurchasePanel.tsx): `src/components/products/PurchasePanel.tsx`
- [Customer Account](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/account/page.tsx): `src/app/account/page.tsx`
- [Reviews](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/reviews/actions.ts): `src/features/reviews/actions.ts`
- [Predictive Search](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`

### Commerce

- [Cart](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/cart.ts): `src/lib/cart.ts`
- [Cart Endpoint](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/api/cart/route.ts): `src/app/api/cart/route.ts`
- [Checkout](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/checkout/actions.ts): `src/features/checkout/actions.ts`
- [Checkout Form](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/checkout/CheckoutForm.tsx): `src/components/checkout/CheckoutForm.tsx`
- [Confirmation & Tracking](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/track-order/page.tsx): `src/app/track-order/page.tsx`
- [Wishlist](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/wishlist/actions.ts): `src/features/wishlist/actions.ts`

### Admin Operations

- [Admin Console](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/admin/(panel)/page.tsx): `src/app/admin/(panel)/page.tsx`
- [Admin Mutations](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/admin/crud.ts): `src/features/admin/crud.ts`
- [Admin Auth](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/admin/auth.ts): `src/features/admin/auth.ts`

### Content & Support

- [Support & Returns](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/support/page.tsx): `src/app/support/page.tsx`
- [Corporate Quotes](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/components/support/CorporateForm.tsx): `src/components/support/CorporateForm.tsx`
- [Store Content](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/app/blog/page.tsx): `src/app/blog/page.tsx`

### Shared Services

- [Customer Auth](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/features/auth/actions.ts): `src/features/auth/actions.ts`
- **Prisma Database**
- [Store Settings](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/settings.ts): `src/lib/settings.ts`
- [Input Validation](https://github.com/abutalha2937/xshop.pk-ecommerce-full-stack-website/blob/main/src/lib/validation.ts): `src/lib/validation.ts`

### Other components

- **Shopper**
- **Site Visitor**

## Connections

- Shopper → Browse & Search: browses
- Browse & Search → Product Detail: opens product
- Product Detail → Product UI: renders purchase (evidence: `src/app/product/[slug]/page.tsx`)
- Product UI → Cart: adds items (evidence: `src/components/products/PurchasePanel.tsx`)
- Shopper → Cart: manages cart
- Cart Endpoint → Cart: reads cart (evidence: `src/app/api/cart/route.ts`)
- Cart → Prisma Database: reads and writes (evidence: `src/lib/cart.ts`)
- Shopper → Checkout Form: submits order
- Checkout Form → Checkout: invokes checkout
- Checkout → Prisma Database: prices and persists
- Checkout → Store Settings: reads shipping rules (evidence: `src/features/checkout/actions.ts`)
- Checkout → Input Validation: validates input (evidence: `src/features/checkout/actions.ts`)
- Checkout → Confirmation & Tracking: creates order
- Shopper → Customer Account: manages account
- Customer Account → Customer Auth: updates profile (evidence: `src/app/account/page.tsx`)
- Customer Auth → Prisma Database: reads and writes (evidence: `src/features/auth/actions.ts`)
- Product Detail → Reviews: offers review (evidence: `src/app/product/[slug]/page.tsx`)
- Shopper → Support & Returns: requests support
- Shopper → Corporate Quotes: requests quote
- Site Visitor → Predictive Search: queries catalog
- Shopper → Wishlist: manages wishlist
- Admin Console → Admin Auth: authenticates
- Admin Console → Admin Mutations: manages store
- Admin Mutations → Prisma Database: updates records (evidence: `src/features/admin/crud.ts`)
- Admin Mutations → Admin Auth: requires authorization (evidence: `src/features/admin/crud.ts`)
- Admin Mutations → Store Content: maintains content
- Browse & Search → Prisma Database: reads catalog
- Store Content → Prisma Database: reads content
