# gs-shaykot/hyperreal architecture

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

- Interactive diagram: https://gitdiagram.com/gs-shaykot/hyperreal
- Repository: https://github.com/gs-shaykot/hyperreal

## Overview

This is a Next.js ecommerce application. Shoppers discover products, manage a cart, submit an order for payment, and can then review account information such as addresses, orders, and saved items. Separate account flows handle registration, sign-in, verification, and session management; administrators manage the store and inspect sales analytics. The graph emphasizes the sampled checkout, cart, address, authentication, and admin-dashboard relationships. Other routes and integrations are represented from the repository tree, but their internal wiring is not established by the excerpts.

Main entry points: [`lib/prisma.ts`](https://github.com/gs-shaykot/hyperreal/blob/main/lib/prisma.ts) (PostgreSQL data), [`app/api/order/route.ts`](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/order/route.ts) (Order checkout), [`app/(Routes)/admin/page.tsx`](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/page.tsx) (Admin dashboard), [`app/page.tsx`](https://github.com/gs-shaykot/hyperreal/blob/main/app/page.tsx) (Home discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home discovery<br/>[page.tsx]"]
  node_home_features["Home features"]
  node_catalog["Product catalog<br/>[page.tsx]"]
  node_product_details["Product details<br/>[ProductDetails.tsx]"]
end

subgraph group_identity["Identity and account"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_registration["Registration and recovery<br/>[page.tsx]"]
  node_otp["Email verification<br/>[route.ts]"]
  node_account["Account management<br/>[page.tsx]"]
  node_addresses["Address management<br/>[route.ts]"]
  node_sessions["Session management<br/>[route.ts]"]
end

subgraph group_commerce["Cart and payments"]
  node_cart["Shopping cart<br/>[route.ts]"]
  node_cart_ui["Cart interface<br/>[page.tsx]"]
  node_checkout["Order checkout<br/>[route.ts]"]
  node_order_calc["Order calculation<br/>[orderService.ts]"]
  node_payment_service["Payment completion<br/>[paymentService.ts]"]
  node_payment_gateway["Payment gateways<br/>[stripe.ts]"]
  node_payment_status["Payment outcomes<br/>[page.tsx]"]
end

subgraph group_operations["Store administration"]
  node_admin["Admin dashboard<br/>[page.tsx]"]
  node_admin_products["Product administration<br/>[page.tsx]"]
  node_admin_orders["Order administration<br/>[page.tsx]"]
  node_analytics["Sales analytics"]
end

node_shopper(("Shopper"))
node_database[("PostgreSQL data<br/>[prisma.ts]")]
node_admin_user(("Administrator"))

node_shopper -->|"browses"| node_home
node_home -->|"renders"| node_home_features
node_shopper -.->|"browses"| node_catalog
node_shopper -.->|"views"| node_product_details
node_shopper -.->|"registers or recovers"| node_registration
node_registration -.->|"requests verification"| node_otp
node_otp -->|"stores OTP"| node_database
node_shopper -.->|"signs in"| node_auth
node_auth -->|"reads and updates sessions"| node_database
node_shopper -.->|"manages account"| node_account
node_account -.->|"manages addresses"| node_addresses
node_addresses -->|"reads and writes addresses"| node_database
node_shopper -.->|"manages sessions"| node_sessions
node_sessions -->|"reads and updates sessions"| node_database
node_shopper -.->|"updates cart"| node_cart_ui
node_cart_ui -.->|"uses cart API"| node_cart
node_cart -->|"reads and writes cart"| node_database
node_shopper -.->|"submits order"| node_checkout
node_checkout -->|"calculates totals"| node_order_calc
node_order_calc -->|"reads variants and coupons"| node_database
node_checkout -->|"completes payment"| node_payment_service
node_payment_service -->|"updates order and stock"| node_database
node_checkout -->|"initiates payment"| node_payment_gateway
node_payment_gateway -.->|"returns payment outcome"| node_payment_status
node_admin_user -.->|"reviews dashboard"| node_admin
node_admin -->|"loads metrics"| node_analytics
node_admin -.->|"manages products"| node_admin_products
node_admin -.->|"manages orders"| node_admin_orders
node_analytics -.->|"queries store data"| node_database

click node_home "https://github.com/gs-shaykot/hyperreal/blob/main/app/page.tsx"
click node_home_features "https://github.com/gs-shaykot/hyperreal/tree/main/app/components/(Home_Components)"
click node_catalog "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/products/page.tsx"
click node_product_details "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/products/%5Bid%5D/ProductDetails.tsx"
click node_auth "https://github.com/gs-shaykot/hyperreal/blob/main/lib/auth.ts"
click node_registration "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/(auth)/register/page.tsx"
click node_otp "https://github.com/gs-shaykot/hyperreal/blob/main/app/api/sendOtp/route.ts"
click node_account "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/account/overview/page.tsx"
click node_addresses "https://github.com/gs-shaykot/hyperreal/blob/main/app/api/address/route.ts"
click node_sessions "https://github.com/gs-shaykot/hyperreal/blob/main/app/api/account/sessions/route.ts"
click node_cart "https://github.com/gs-shaykot/hyperreal/blob/main/app/api/cart/cartItem/route.ts"
click node_cart_ui "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/cart/page.tsx"
click node_checkout "https://github.com/gs-shaykot/hyperreal/blob/main/app/api/order/route.ts"
click node_order_calc "https://github.com/gs-shaykot/hyperreal/blob/main/lib/service/orderService.ts"
click node_payment_service "https://github.com/gs-shaykot/hyperreal/blob/main/lib/service/paymentService.ts"
click node_payment_gateway "https://github.com/gs-shaykot/hyperreal/blob/main/lib/stripe.ts"
click node_payment_status "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/(Payment%20Status)/success/page.tsx"
click node_database "https://github.com/gs-shaykot/hyperreal/blob/main/lib/prisma.ts"
click node_admin "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/page.tsx"
click node_admin_products "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/products/page.tsx"
click node_admin_orders "https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/orders/page.tsx"
click node_analytics "https://github.com/gs-shaykot/hyperreal/tree/main/utils/AdminUtils"

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_home_features,node_catalog,node_product_details toneBlue
class node_auth,node_registration,node_otp,node_account,node_addresses,node_sessions,node_database toneAmber
class node_cart,node_cart_ui,node_checkout,node_order_calc,node_payment_service,node_payment_gateway,node_payment_status toneMint
class node_admin,node_admin_products,node_admin_orders,node_analytics toneRose
class node_shopper,node_admin_user toneIndigo
```

## Components

### Storefront

- [Home discovery](https://github.com/gs-shaykot/hyperreal/blob/main/app/page.tsx): `app/page.tsx`
- [Home features](https://github.com/gs-shaykot/hyperreal/tree/main/app/components/(Home_Components)): `app/components/(Home_Components)`
- [Product catalog](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/products/page.tsx): `app/(Routes)/products/page.tsx`
- [Product details](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/products/%5Bid%5D/ProductDetails.tsx): `app/(Routes)/products/[id]/ProductDetails.tsx`

### Identity and account

- [Authentication](https://github.com/gs-shaykot/hyperreal/blob/main/lib/auth.ts): `lib/auth.ts`
- [Registration and recovery](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/(auth)/register/page.tsx): `app/(Routes)/(auth)/register/page.tsx`
- [Email verification](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/sendOtp/route.ts): `app/api/sendOtp/route.ts`
- [Account management](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/account/overview/page.tsx): `app/(Routes)/account/overview/page.tsx`
- [Address management](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/address/route.ts): `app/api/address/route.ts`
- [Session management](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/account/sessions/route.ts): `app/api/account/sessions/route.ts`

### Cart and payments

- [Shopping cart](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/cart/cartItem/route.ts): `app/api/cart/cartItem/route.ts`
- [Cart interface](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/cart/page.tsx): `app/(Routes)/cart/page.tsx`
- [Order checkout](https://github.com/gs-shaykot/hyperreal/blob/main/app/api/order/route.ts): `app/api/order/route.ts`
- [Order calculation](https://github.com/gs-shaykot/hyperreal/blob/main/lib/service/orderService.ts): `lib/service/orderService.ts`
- [Payment completion](https://github.com/gs-shaykot/hyperreal/blob/main/lib/service/paymentService.ts): `lib/service/paymentService.ts`
- [Payment gateways](https://github.com/gs-shaykot/hyperreal/blob/main/lib/stripe.ts): `lib/stripe.ts`
- [Payment outcomes](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/(Payment%20Status)/success/page.tsx): `app/(Routes)/(Payment Status)/success/page.tsx`

### Store administration

- [Admin dashboard](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/page.tsx): `app/(Routes)/admin/page.tsx`
- [Product administration](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/products/page.tsx): `app/(Routes)/admin/products/page.tsx`
- [Order administration](https://github.com/gs-shaykot/hyperreal/blob/main/app/(Routes)/admin/orders/page.tsx): `app/(Routes)/admin/orders/page.tsx`
- [Sales analytics](https://github.com/gs-shaykot/hyperreal/tree/main/utils/AdminUtils): `utils/AdminUtils`

### Other components

- **Shopper**
- [PostgreSQL data](https://github.com/gs-shaykot/hyperreal/blob/main/lib/prisma.ts): `lib/prisma.ts`
- **Administrator**

## Connections

- Shopper → Home discovery: browses (evidence: `app/page.tsx`)
- Home discovery → Home features: renders (evidence: `app/page.tsx`)
- Shopper → Product catalog: browses
- Shopper → Product details: views
- Shopper → Registration and recovery: registers or recovers
- Registration and recovery → Email verification: requests verification
- Email verification → PostgreSQL data: stores OTP (evidence: `app/api/sendOtp/route.ts`)
- Shopper → Authentication: signs in
- Authentication → PostgreSQL data: reads and updates sessions (evidence: `lib/auth.ts`)
- Shopper → Account management: manages account
- Account management → Address management: manages addresses
- Address management → PostgreSQL data: reads and writes addresses (evidence: `app/api/address/route.ts`)
- Shopper → Session management: manages sessions
- Session management → PostgreSQL data: reads and updates sessions (evidence: `app/api/account/sessions/route.ts`)
- Shopper → Cart interface: updates cart
- Cart interface → Shopping cart: uses cart API
- Shopping cart → PostgreSQL data: reads and writes cart (evidence: `app/api/cart/cartItem/route.ts`)
- Shopper → Order checkout: submits order
- Order checkout → Order calculation: calculates totals (evidence: `app/api/order/route.ts`)
- Order calculation → PostgreSQL data: reads variants and coupons (evidence: `lib/service/orderService.ts`)
- Order checkout → Payment completion: completes payment (evidence: `app/api/order/route.ts`)
- Payment completion → PostgreSQL data: updates order and stock (evidence: `lib/service/paymentService.ts`)
- Order checkout → Payment gateways: initiates payment (evidence: `app/api/order/route.ts`)
- Payment gateways → Payment outcomes: returns payment outcome
- Administrator → Admin dashboard: reviews dashboard
- Admin dashboard → Sales analytics: loads metrics (evidence: `app/(Routes)/admin/page.tsx`)
- Admin dashboard → Product administration: manages products
- Admin dashboard → Order administration: manages orders
- Sales analytics → PostgreSQL data: queries store data (evidence: `utils/AdminUtils/getAdminProducts.ts`)
