# hasarangasam/velora architecture

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

- Interactive diagram: https://gitdiagram.com/hasarangasam/velora
- Repository: https://github.com/hasarangasam/velora

## Overview

Velora is a Sri Lankan fashion-commerce application spanning discovery, cart and checkout, payment confirmation, customer accounts, and administration. The main customer path runs from storefront pages through cart synchronization and order creation to PayHere notification and order history. The graph highlights that server-side order and payment handlers own pricing, persistence, inventory, coupon, and notification actions. README capabilities are included where their source paths are present; some connections are omitted because excerpts do not show their exact wiring.

Main entry points: [`src/lib/db/prisma.ts`](https://github.com/hasarangasam/velora/blob/main/src/lib/db/prisma.ts) (Commerce database), [`src/app/api/orders/route.ts`](https://github.com/hasarangasam/velora/blob/main/src/app/api/orders/route.ts) (Order creation), [`src/app/api/admin/products/route.ts`](https://github.com/hasarangasam/velora/blob/main/src/app/api/admin/products/route.ts) (Product management), [`src/app/admin/page.tsx`](https://github.com/hasarangasam/velora/blob/main/src/app/admin/page.tsx) (Admin operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront["Storefront pages<br/>[page.tsx]"]
  node_catalog["Catalog queries<br/>[catalog.ts]"]
  node_product["Product detail<br/>[page.tsx]"]
  node_search["Product search<br/>[route.ts]"]
  node_reviews["Reviews<br/>[reviews.ts]"]
  node_wishlist["Wishlist<br/>[actions.ts]"]
end

subgraph group_commerce["Commerce"]
  node_cartui["Cart interface<br/>[CartPageClient.tsx]"]
  node_cartstate["Cart state<br/>[cartStore.ts]"]
  node_cartapi["Cart endpoints<br/>[route.ts]"]
  node_checkoutui["Checkout interface"]
  node_orders["Order creation<br/>[route.ts]"]
  node_orderlogic["Order totals<br/>[order.ts]"]
  node_paymentui["PayHere checkout<br/>[PayHereForm.tsx]"]
  node_paynotify["Payment notification<br/>[route.ts]"]
  node_orderaccount["Order history<br/>[page.tsx]"]
end

subgraph group_identity["Identity &amp; accounts"]
  node_accounts["Account management<br/>[actions.ts]"]
  node_addresses["Saved addresses<br/>[route.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
end

subgraph group_operations["Operations"]
  node_adminui["Admin operations<br/>[page.tsx]"]
  node_adminproducts["Product management<br/>[route.ts]"]
  node_adminorders["Order fulfillment<br/>[actions.ts]"]
  node_adminreviews["Review moderation<br/>[actions.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_platform["Server services"]
  node_prisma[("Commerce database<br/>[prisma.ts]")]
  node_pricing["Product pricing<br/>[product-pricing.ts]"]
  node_cloudinary["Image service<br/>[cloudinary.ts]"]
  node_email["Email delivery<br/>[email.ts]"]
  node_redis[("Cache and limits<br/>[redis.ts]")]
end

node_shopper(("Shopper"))
node_payhere["PayHere"]

node_shopper -->|"browses"| node_storefront
node_storefront -->|"loads products"| node_catalog
node_shopper -->|"searches"| node_search
node_shopper -->|"opens product"| node_product
node_shopper -->|"manages cart"| node_cartui
node_cartui -->|"updates state"| node_cartstate
node_cartui -->|"syncs cart"| node_cartapi
node_cartapi -->|"reads/writes cart"| node_prisma
node_shopper -->|"checks out"| node_checkoutui
node_checkoutui -->|"submits order"| node_orders
node_orders -->|"calculates totals"| node_orderlogic
node_orders -->|"checks current price"| node_pricing
node_orders -->|"persists order"| node_prisma
node_orders -->|"alerts admins"| node_notifications
node_orders -->|"returns pending order"| node_paymentui
node_paymentui -->|"starts payment"| node_payhere
node_payhere -->|"sends result"| node_paynotify
node_paynotify -->|"confirms payment"| node_prisma
node_paynotify -->|"sends confirmation"| node_email
node_shopper -->|"tracks order"| node_orderaccount
node_orderaccount -->|"reads orders"| node_prisma
node_product -->|"loads reviews"| node_reviews
node_shopper -->|"manages wishlist"| node_wishlist
node_wishlist -->|"reads/writes wishlist"| node_prisma
node_accounts -->|"updates account"| node_prisma
node_addresses -->|"reads/writes addresses"| node_prisma
node_shopper -->|"signs in"| node_auth
node_adminui -->|"manages catalog"| node_adminproducts
node_adminproducts -->|"writes products"| node_prisma
node_adminproducts -->|"invalidates catalog"| node_redis
node_adminproducts -.->|"manages images"| node_cloudinary
node_adminui -->|"fulfills orders"| node_adminorders
node_adminorders -->|"updates order"| node_prisma
node_adminui -->|"moderates reviews"| node_adminreviews
node_adminreviews -->|"updates review status"| node_prisma
node_notifications -->|"stores notifications"| node_prisma
node_search -.->|"searches catalog"| node_catalog

click node_storefront "https://github.com/hasarangasam/velora/blob/main/src/app/(shop)/shop/page.tsx"
click node_catalog "https://github.com/hasarangasam/velora/blob/main/src/lib/catalog.ts"
click node_product "https://github.com/hasarangasam/velora/blob/main/src/app/(shop)/products/%5Bslug%5D/page.tsx"
click node_search "https://github.com/hasarangasam/velora/blob/main/src/app/api/search/route.ts"
click node_reviews "https://github.com/hasarangasam/velora/blob/main/src/lib/reviews.ts"
click node_wishlist "https://github.com/hasarangasam/velora/blob/main/src/app/account/wishlist/actions.ts"
click node_cartui "https://github.com/hasarangasam/velora/blob/main/src/components/shop/CartPageClient.tsx"
click node_cartstate "https://github.com/hasarangasam/velora/blob/main/src/store/cartStore.ts"
click node_cartapi "https://github.com/hasarangasam/velora/blob/main/src/app/api/cart/route.ts"
click node_checkoutui "https://github.com/hasarangasam/velora/blob/main/src/components/checkout/CheckoutPageClient.tsx"
click node_orders "https://github.com/hasarangasam/velora/blob/main/src/app/api/orders/route.ts"
click node_orderlogic "https://github.com/hasarangasam/velora/blob/main/src/lib/order.ts"
click node_paymentui "https://github.com/hasarangasam/velora/blob/main/src/components/payment/PayHereForm.tsx"
click node_paynotify "https://github.com/hasarangasam/velora/blob/main/src/app/api/payments/payhere/notify/route.ts"
click node_orderaccount "https://github.com/hasarangasam/velora/blob/main/src/app/account/orders/page.tsx"
click node_accounts "https://github.com/hasarangasam/velora/blob/main/src/app/account/profile/actions.ts"
click node_addresses "https://github.com/hasarangasam/velora/blob/main/src/app/api/addresses/route.ts"
click node_auth "https://github.com/hasarangasam/velora/blob/main/auth.ts"
click node_adminui "https://github.com/hasarangasam/velora/blob/main/src/app/admin/page.tsx"
click node_adminproducts "https://github.com/hasarangasam/velora/blob/main/src/app/api/admin/products/route.ts"
click node_adminorders "https://github.com/hasarangasam/velora/blob/main/src/app/admin/orders/actions.ts"
click node_adminreviews "https://github.com/hasarangasam/velora/blob/main/src/app/admin/reviews/actions.ts"
click node_notifications "https://github.com/hasarangasam/velora/blob/main/src/lib/notifications.ts"
click node_prisma "https://github.com/hasarangasam/velora/blob/main/src/lib/db/prisma.ts"
click node_pricing "https://github.com/hasarangasam/velora/blob/main/src/lib/product-pricing.ts"
click node_cloudinary "https://github.com/hasarangasam/velora/blob/main/src/lib/cloudinary.ts"
click node_email "https://github.com/hasarangasam/velora/blob/main/src/lib/email.ts"
click node_redis "https://github.com/hasarangasam/velora/blob/main/src/lib/redis.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,node_catalog,node_product,node_search,node_reviews,node_wishlist toneBlue
class node_cartui,node_cartstate,node_cartapi,node_checkoutui,node_orders,node_orderlogic,node_paymentui,node_paynotify,node_orderaccount toneAmber
class node_accounts,node_addresses,node_auth toneMint
class node_adminui,node_adminproducts,node_adminorders,node_adminreviews,node_notifications toneRose
class node_prisma,node_pricing,node_cloudinary,node_email,node_redis,node_shopper,node_payhere toneIndigo
```

## Components

### Storefront

- [Storefront pages](https://github.com/hasarangasam/velora/blob/main/src/app/(shop)/shop/page.tsx): `src/app/(shop)/shop/page.tsx`
- [Catalog queries](https://github.com/hasarangasam/velora/blob/main/src/lib/catalog.ts): `src/lib/catalog.ts`
- [Product detail](https://github.com/hasarangasam/velora/blob/main/src/app/(shop)/products/%5Bslug%5D/page.tsx): `src/app/(shop)/products/[slug]/page.tsx`
- [Product search](https://github.com/hasarangasam/velora/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`
- [Reviews](https://github.com/hasarangasam/velora/blob/main/src/lib/reviews.ts): `src/lib/reviews.ts`
- [Wishlist](https://github.com/hasarangasam/velora/blob/main/src/app/account/wishlist/actions.ts): `src/app/account/wishlist/actions.ts`

### Commerce

- [Cart interface](https://github.com/hasarangasam/velora/blob/main/src/components/shop/CartPageClient.tsx): `src/components/shop/CartPageClient.tsx`
- [Cart state](https://github.com/hasarangasam/velora/blob/main/src/store/cartStore.ts): `src/store/cartStore.ts`
- [Cart endpoints](https://github.com/hasarangasam/velora/blob/main/src/app/api/cart/route.ts): `src/app/api/cart/route.ts`
- [Checkout interface](https://github.com/hasarangasam/velora/blob/main/src/components/checkout/CheckoutPageClient.tsx): `src/components/checkout/CheckoutPageClient.tsx`
- [Order creation](https://github.com/hasarangasam/velora/blob/main/src/app/api/orders/route.ts): `src/app/api/orders/route.ts`
- [Order totals](https://github.com/hasarangasam/velora/blob/main/src/lib/order.ts): `src/lib/order.ts`
- [PayHere checkout](https://github.com/hasarangasam/velora/blob/main/src/components/payment/PayHereForm.tsx): `src/components/payment/PayHereForm.tsx`
- [Payment notification](https://github.com/hasarangasam/velora/blob/main/src/app/api/payments/payhere/notify/route.ts): `src/app/api/payments/payhere/notify/route.ts`
- [Order history](https://github.com/hasarangasam/velora/blob/main/src/app/account/orders/page.tsx): `src/app/account/orders/page.tsx`

### Identity & accounts

- [Account management](https://github.com/hasarangasam/velora/blob/main/src/app/account/profile/actions.ts): `src/app/account/profile/actions.ts`
- [Saved addresses](https://github.com/hasarangasam/velora/blob/main/src/app/api/addresses/route.ts): `src/app/api/addresses/route.ts`
- [Authentication](https://github.com/hasarangasam/velora/blob/main/auth.ts): `auth.ts`

### Operations

- [Admin operations](https://github.com/hasarangasam/velora/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Product management](https://github.com/hasarangasam/velora/blob/main/src/app/api/admin/products/route.ts): `src/app/api/admin/products/route.ts`
- [Order fulfillment](https://github.com/hasarangasam/velora/blob/main/src/app/admin/orders/actions.ts): `src/app/admin/orders/actions.ts`
- [Review moderation](https://github.com/hasarangasam/velora/blob/main/src/app/admin/reviews/actions.ts): `src/app/admin/reviews/actions.ts`
- [Notifications](https://github.com/hasarangasam/velora/blob/main/src/lib/notifications.ts): `src/lib/notifications.ts`

### Server services

- [Commerce database](https://github.com/hasarangasam/velora/blob/main/src/lib/db/prisma.ts): `src/lib/db/prisma.ts`
- [Product pricing](https://github.com/hasarangasam/velora/blob/main/src/lib/product-pricing.ts): `src/lib/product-pricing.ts`
- [Image service](https://github.com/hasarangasam/velora/blob/main/src/lib/cloudinary.ts): `src/lib/cloudinary.ts`
- [Email delivery](https://github.com/hasarangasam/velora/blob/main/src/lib/email.ts): `src/lib/email.ts`
- [Cache and limits](https://github.com/hasarangasam/velora/blob/main/src/lib/redis.ts): `src/lib/redis.ts`

### Other components

- **Shopper**
- **PayHere**

## Connections

- Shopper → Storefront pages: browses
- Storefront pages → Catalog queries: loads products
- Shopper → Product search: searches
- Shopper → Product detail: opens product
- Shopper → Cart interface: manages cart
- Cart interface → Cart state: updates state
- Cart interface → Cart endpoints: syncs cart
- Cart endpoints → Commerce database: reads/writes cart
- Shopper → Checkout interface: checks out
- Checkout interface → Order creation: submits order
- Order creation → Order totals: calculates totals
- Order creation → Product pricing: checks current price
- Order creation → Commerce database: persists order
- Order creation → Notifications: alerts admins
- Order creation → PayHere checkout: returns pending order
- PayHere checkout → PayHere: starts payment
- PayHere → Payment notification: sends result
- Payment notification → Commerce database: confirms payment
- Payment notification → Email delivery: sends confirmation
- Shopper → Order history: tracks order
- Order history → Commerce database: reads orders
- Product detail → Reviews: loads reviews
- Shopper → Wishlist: manages wishlist
- Wishlist → Commerce database: reads/writes wishlist
- Account management → Commerce database: updates account
- Saved addresses → Commerce database: reads/writes addresses
- Shopper → Authentication: signs in
- Admin operations → Product management: manages catalog
- Product management → Commerce database: writes products
- Product management → Cache and limits: invalidates catalog
- Product management → Image service: manages images
- Admin operations → Order fulfillment: fulfills orders
- Order fulfillment → Commerce database: updates order
- Admin operations → Review moderation: moderates reviews
- Review moderation → Commerce database: updates review status
- Notifications → Commerce database: stores notifications
- Product search → Catalog queries: searches catalog
