# bshemphang/cloudpeak-store architecture

> Architecture diagram of the GitHub repository bshemphang/cloudpeak-store, 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/bshemphang/cloudpeak-store
- Repository: https://github.com/bshemphang/cloudpeak-store

## Overview

Cloudpeak is a Next.js streetwear storefront with customer accounts, product browsing, checkout and an admin catalogue/order-management area. The main customer path is browse products, add items to a cart, submit an order, complete Razorpay payment, and receive confirmation. The graph also preserves reviews, newsletter signup, product feeds and admin analytics as distinct capabilities. Several routes and persistence modules are listed but not excerpted; uncertain links are omitted or marked dashed rather than inferred from names.

Main entry points: [`app/checkout/page.tsx`](https://github.com/bshemphang/cloudpeak-store/blob/main/app/checkout/page.tsx) (Checkout), [`app/api/orders/route.ts`](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/orders/route.ts) (Order API), [`app/shop/[slug]/ProductDetailClient.tsx`](https://github.com/bshemphang/cloudpeak-store/blob/main/app/shop/%5Bslug%5D/ProductDetailClient.tsx) (Product Detail), [`lib/email-service.ts`](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/email-service.ts) (Email Outbox)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home Page<br/>[page.tsx]"]
  node_shop["Shop Collection<br/>[ShopClient.tsx]"]
  node_product["Product Detail"]
  node_auth["Customer Accounts<br/>[AuthContext.tsx]"]
  node_reviews[("Product Reviews<br/>[reviews-store.ts]")]
  node_newsletter["Newsletter Signup<br/>[route.ts]"]
end

subgraph group_commerce["Orders and Payments"]
  node_cart["Shopping Cart<br/>[CartContext.tsx]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_order_api["Order API<br/>[route.ts]"]
  node_order_utils["Order Validation<br/>[order-utils.ts]"]
  node_orders[("Order Store<br/>[orders-store.ts]")]
  node_payment["Razorpay"]
  node_verify["Payment Verification<br/>[route.ts]"]
  node_webhook["Payment Webhook<br/>[route.ts]"]
  node_confirmation["Order Confirmation<br/>[page.tsx]"]
end

subgraph group_management["Admin and Catalogue"]
  node_catalog_api["Product API<br/>[route.ts]"]
  node_products[("Product Store<br/>[products-store.ts]")]
  node_feed["Product Feed<br/>[route.ts]"]
  node_admin["Admin Console<br/>[page.tsx]"]
  node_admin_auth["Admin Authentication<br/>[useAdminAuth.ts]"]
  node_analytics["Sales Analytics<br/>[page.tsx]"]
end

subgraph group_services["Shared Services"]
  node_subscribers[("Subscribers")]
  node_email[("Email Outbox<br/>[email-service.ts]")]
  node_templates["Email Templates<br/>[email-templates.ts]"]
  node_supabase[("Supabase<br/>[supabase.ts]")]
end

node_customer(("Shopper"))

node_customer -->|"visits"| node_home
node_customer -->|"browses"| node_shop
node_customer -.->|"selects"| node_product
node_product -.->|"adds items"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"reads account"| node_auth
node_customer -->|"submits order"| node_checkout
node_checkout -->|"creates order"| node_order_api
node_order_api -->|"validates and builds"| node_order_utils
node_order_api -->|"saves order"| node_orders
node_checkout -->|"starts payment"| node_payment
node_checkout -->|"verifies payment"| node_verify
node_verify -->|"updates payment status"| node_orders
node_payment -.->|"sends event"| node_webhook
node_webhook -->|"updates payment status"| node_orders
node_verify -->|"sends confirmation"| node_email
node_webhook -->|"sends confirmation"| node_email
node_order_api -->|"sends order email"| node_email
node_customer -->|"subscribes"| node_newsletter
node_newsletter -->|"adds subscriber"| node_subscribers
node_newsletter -->|"sends welcome"| node_email
node_feed -->|"reads products"| node_products
node_feed -.->|"publishes feed"| node_customer
node_admin_auth -.->|"authenticates"| node_admin
node_admin_auth -->|"checks access"| node_order_api
node_admin -->|"opens analytics"| node_analytics
node_catalog_api -.->|"accesses catalogue"| node_products
node_shop -.->|"opens product"| node_product
node_product -.->|"loads reviews"| node_reviews
node_supabase -.->|"backs persistence"| node_products

click node_home "https://github.com/bshemphang/cloudpeak-store/blob/main/app/page.tsx"
click node_shop "https://github.com/bshemphang/cloudpeak-store/blob/main/app/shop/ShopClient.tsx"
click node_product "https://github.com/bshemphang/cloudpeak-store/blob/main/app/shop/%5Bslug%5D/ProductDetailClient.tsx"
click node_cart "https://github.com/bshemphang/cloudpeak-store/blob/main/context/CartContext.tsx"
click node_checkout "https://github.com/bshemphang/cloudpeak-store/blob/main/app/checkout/page.tsx"
click node_order_api "https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/orders/route.ts"
click node_order_utils "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/order-utils.ts"
click node_orders "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/orders-store.ts"
click node_verify "https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/verify-payment/route.ts"
click node_webhook "https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/razorpay-webhook/route.ts"
click node_confirmation "https://github.com/bshemphang/cloudpeak-store/blob/main/app/order-confirmation/%5Bid%5D/page.tsx"
click node_auth "https://github.com/bshemphang/cloudpeak-store/blob/main/context/AuthContext.tsx"
click node_reviews "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/reviews-store.ts"
click node_newsletter "https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/newsletter/route.ts"
click node_subscribers "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/subscribers-store.ts"
click node_catalog_api "https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/products/route.ts"
click node_products "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/products-store.ts"
click node_feed "https://github.com/bshemphang/cloudpeak-store/blob/main/app/products-feed.xml/route.ts"
click node_admin "https://github.com/bshemphang/cloudpeak-store/blob/main/app/admin/page.tsx"
click node_admin_auth "https://github.com/bshemphang/cloudpeak-store/blob/main/hooks/useAdminAuth.ts"
click node_analytics "https://github.com/bshemphang/cloudpeak-store/blob/main/app/admin/analytics/page.tsx"
click node_email "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/email-service.ts"
click node_templates "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/email-templates.ts"
click node_supabase "https://github.com/bshemphang/cloudpeak-store/blob/main/lib/supabase.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_shop,node_product,node_auth,node_reviews,node_newsletter toneBlue
class node_cart,node_checkout,node_order_api,node_order_utils,node_orders,node_payment,node_verify,node_webhook,node_confirmation toneAmber
class node_catalog_api,node_products,node_feed,node_admin,node_admin_auth,node_analytics toneMint
class node_subscribers,node_email,node_templates,node_supabase toneRose
class node_customer toneIndigo
```

## Components

### Storefront

- [Home Page](https://github.com/bshemphang/cloudpeak-store/blob/main/app/page.tsx): `app/page.tsx`
- [Shop Collection](https://github.com/bshemphang/cloudpeak-store/blob/main/app/shop/ShopClient.tsx): `app/shop/ShopClient.tsx`
- [Product Detail](https://github.com/bshemphang/cloudpeak-store/blob/main/app/shop/%5Bslug%5D/ProductDetailClient.tsx): `app/shop/[slug]/ProductDetailClient.tsx`
- [Customer Accounts](https://github.com/bshemphang/cloudpeak-store/blob/main/context/AuthContext.tsx): `context/AuthContext.tsx`
- [Product Reviews](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/reviews-store.ts): `lib/reviews-store.ts`
- [Newsletter Signup](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/newsletter/route.ts): `app/api/newsletter/route.ts`

### Orders and Payments

- [Shopping Cart](https://github.com/bshemphang/cloudpeak-store/blob/main/context/CartContext.tsx): `context/CartContext.tsx`
- [Checkout](https://github.com/bshemphang/cloudpeak-store/blob/main/app/checkout/page.tsx): `app/checkout/page.tsx`
- [Order API](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/orders/route.ts): `app/api/orders/route.ts`
- [Order Validation](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/order-utils.ts): `lib/order-utils.ts`
- [Order Store](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/orders-store.ts): `lib/orders-store.ts`
- **Razorpay**
- [Payment Verification](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/verify-payment/route.ts): `app/api/verify-payment/route.ts`
- [Payment Webhook](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/razorpay-webhook/route.ts): `app/api/razorpay-webhook/route.ts`
- [Order Confirmation](https://github.com/bshemphang/cloudpeak-store/blob/main/app/order-confirmation/%5Bid%5D/page.tsx): `app/order-confirmation/[id]/page.tsx`

### Admin and Catalogue

- [Product API](https://github.com/bshemphang/cloudpeak-store/blob/main/app/api/products/route.ts): `app/api/products/route.ts`
- [Product Store](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/products-store.ts): `lib/products-store.ts`
- [Product Feed](https://github.com/bshemphang/cloudpeak-store/blob/main/app/products-feed.xml/route.ts): `app/products-feed.xml/route.ts`
- [Admin Console](https://github.com/bshemphang/cloudpeak-store/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin Authentication](https://github.com/bshemphang/cloudpeak-store/blob/main/hooks/useAdminAuth.ts): `hooks/useAdminAuth.ts`
- [Sales Analytics](https://github.com/bshemphang/cloudpeak-store/blob/main/app/admin/analytics/page.tsx): `app/admin/analytics/page.tsx`

### Shared Services

- [Subscribers](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/subscribers-store.ts): `lib/subscribers-store.ts`
- [Email Outbox](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/email-service.ts): `lib/email-service.ts`
- [Email Templates](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/email-templates.ts): `lib/email-templates.ts`
- [Supabase](https://github.com/bshemphang/cloudpeak-store/blob/main/lib/supabase.ts): `lib/supabase.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Home Page: visits (evidence: `README.md`)
- Shopper → Shop Collection: browses (evidence: `README.md`)
- Shopper → Product Detail: selects
- Product Detail → Shopping Cart: adds items (evidence: `app/shop/[slug]/ProductDetailClient.tsx`)
- Checkout → Shopping Cart: reads cart (evidence: `app/checkout/page.tsx`)
- Checkout → Customer Accounts: reads account (evidence: `app/checkout/page.tsx`)
- Shopper → Checkout: submits order (evidence: `README.md`)
- Checkout → Order API: creates order (evidence: `app/checkout/page.tsx`)
- Order API → Order Validation: validates and builds (evidence: `app/api/orders/route.ts`)
- Order API → Order Store: saves order (evidence: `app/api/orders/route.ts`)
- Checkout → Razorpay: starts payment (evidence: `README.md`)
- Checkout → Payment Verification: verifies payment (evidence: `app/checkout/page.tsx`)
- Payment Verification → Order Store: updates payment status (evidence: `app/api/verify-payment/route.ts`)
- Razorpay → Payment Webhook: sends event
- Payment Webhook → Order Store: updates payment status (evidence: `app/api/razorpay-webhook/route.ts`)
- Payment Verification → Email Outbox: sends confirmation (evidence: `app/api/verify-payment/route.ts`)
- Payment Webhook → Email Outbox: sends confirmation (evidence: `app/api/razorpay-webhook/route.ts`)
- Order API → Email Outbox: sends order email (evidence: `app/api/orders/route.ts`)
- Shopper → Newsletter Signup: subscribes (evidence: `app/api/newsletter/route.ts`)
- Newsletter Signup → Subscribers: adds subscriber (evidence: `app/api/newsletter/route.ts`)
- Newsletter Signup → Email Outbox: sends welcome (evidence: `app/api/newsletter/route.ts`)
- Product Feed → Product Store: reads products (evidence: `app/products-feed.xml/route.ts`)
- Product Feed → Shopper: publishes feed
- Admin Authentication → Admin Console: authenticates
- Admin Authentication → Order API: checks access (evidence: `hooks/useAdminAuth.ts`)
- Admin Console → Sales Analytics: opens analytics (evidence: `app/admin/analytics/page.tsx`)
- Product API → Product Store: accesses catalogue
- Shop Collection → Product Detail: opens product
- Product Detail → Product Reviews: loads reviews
- Supabase → Product Store: backs persistence
