# gvardhan97/next_store architecture

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

- Interactive diagram: https://gitdiagram.com/gvardhan97/next_store
- Repository: https://github.com/gvardhan97/next_store

## Overview

This is a Next.js e-commerce storefront. The main customer journey is browsing the product catalog, viewing a product, adding it to a per-user cart, creating an order, and completing Stripe checkout; review and favorite features branch from product pages. Admins manage products separately. Server actions coordinate authentication, validation, database operations, and image storage. The README documents several integrations and flows whose implementation was not sampled, so those links are cited to the README; source-level edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`utils/actions.ts`](https://github.com/gvardhan97/next_store/blob/main/utils/actions.ts) (Server Actions), [`app/products/[id]/page.tsx`](https://github.com/gvardhan97/next_store/blob/main/app/products/%5Bid%5D/page.tsx) (Product Detail), [`utils/db.ts`](https://github.com/gvardhan97/next_store/blob/main/utils/db.ts) (Prisma Data Store), [`app/products/page.tsx`](https://github.com/gvardhan97/next_store/blob/main/app/products/page.tsx) (Product Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog["Product Catalog<br/>[page.tsx]"]
  node_home["Home Page<br/>[page.tsx]"]
  node_product["Product Detail<br/>[page.tsx]"]
  node_product_ui["Catalog Components"]
end

subgraph group_engagement["Customer Features"]
  node_favorites["Favorites<br/>[page.tsx]"]
  node_reviews["Reviews<br/>[page.tsx]"]
  node_review_form["Review Submission<br/>[SubmitReview.tsx]"]
end

subgraph group_commerce["Cart And Orders"]
  node_cart["Shopping Cart<br/>[page.tsx]"]
  node_checkout["Checkout Page<br/>[page.tsx]"]
  node_payment_api["Payment Session API<br/>[route.ts]"]
  node_confirm_api["Payment Confirmation API<br/>[route.ts]"]
  node_orders["Order History<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin_products["Product Management"]
  node_admin_sales["Sales Management<br/>[page.tsx]"]
end

subgraph group_backend["Server And Integrations"]
  node_actions["Server Actions<br/>[actions.ts]"]
  node_database[("Prisma Data Store<br/>[db.ts]")]
  node_clerk{{"Clerk Auth"}}
  node_supabase["Supabase Storage<br/>[supabase.ts]"]
  node_stripe{{"Stripe"}}
end

node_customer(("Customer"))

node_customer -->|"browses"| node_catalog
node_customer -->|"visits"| node_home
node_catalog -->|"opens product"| node_product
node_catalog -->|"renders listings"| node_product_ui
node_product -->|"fetches product"| node_actions
node_product -->|"offers review"| node_review_form
node_product -.->|"links favorites"| node_favorites
node_customer -->|"manages favorites"| node_favorites
node_customer -->|"manages reviews"| node_reviews
node_review_form -->|"submits review"| node_actions
node_reviews -->|"fetches reviews"| node_actions
node_customer -->|"manages cart"| node_cart
node_cart -->|"loads cart"| node_actions
node_actions -->|"reads and writes"| node_database
node_actions -->|"checks identity"| node_clerk
node_actions -->|"uploads images"| node_supabase
node_admin_products -->|"manages products"| node_actions
node_admin_sales -->|"fetches sales"| node_actions
node_customer -->|"starts checkout"| node_checkout
node_checkout -->|"requests session"| node_payment_api
node_payment_api -->|"creates session"| node_stripe
node_payment_api -->|"loads order data"| node_database
node_stripe -->|"confirms payment"| node_confirm_api
node_confirm_api -->|"marks paid"| node_database
node_confirm_api -->|"cleans cart"| node_database
node_customer -->|"views orders"| node_orders
node_orders -->|"fetches orders"| node_actions

click node_catalog "https://github.com/gvardhan97/next_store/blob/main/app/products/page.tsx"
click node_home "https://github.com/gvardhan97/next_store/blob/main/app/page.tsx"
click node_product "https://github.com/gvardhan97/next_store/blob/main/app/products/%5Bid%5D/page.tsx"
click node_product_ui "https://github.com/gvardhan97/next_store/tree/main/components/products"
click node_favorites "https://github.com/gvardhan97/next_store/blob/main/app/favorites/page.tsx"
click node_reviews "https://github.com/gvardhan97/next_store/blob/main/app/reviews/page.tsx"
click node_review_form "https://github.com/gvardhan97/next_store/blob/main/components/reviews/SubmitReview.tsx"
click node_cart "https://github.com/gvardhan97/next_store/blob/main/app/cart/page.tsx"
click node_checkout "https://github.com/gvardhan97/next_store/blob/main/app/checkout/page.tsx"
click node_payment_api "https://github.com/gvardhan97/next_store/blob/main/app/api/payment/route.ts"
click node_confirm_api "https://github.com/gvardhan97/next_store/blob/main/app/api/confirm/route.ts"
click node_orders "https://github.com/gvardhan97/next_store/blob/main/app/orders/page.tsx"
click node_admin_products "https://github.com/gvardhan97/next_store/tree/main/app/admin/products"
click node_admin_sales "https://github.com/gvardhan97/next_store/blob/main/app/admin/sales/page.tsx"
click node_actions "https://github.com/gvardhan97/next_store/blob/main/utils/actions.ts"
click node_database "https://github.com/gvardhan97/next_store/blob/main/utils/db.ts"
click node_supabase "https://github.com/gvardhan97/next_store/blob/main/utils/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_catalog,node_home,node_product,node_product_ui toneBlue
class node_favorites,node_reviews,node_review_form toneAmber
class node_cart,node_checkout,node_payment_api,node_confirm_api,node_orders toneMint
class node_admin_products,node_admin_sales toneRose
class node_actions,node_database,node_clerk,node_supabase,node_stripe,node_customer toneIndigo
```

## Components

### Storefront

- [Product Catalog](https://github.com/gvardhan97/next_store/blob/main/app/products/page.tsx): `app/products/page.tsx`
- [Home Page](https://github.com/gvardhan97/next_store/blob/main/app/page.tsx): `app/page.tsx`
- [Product Detail](https://github.com/gvardhan97/next_store/blob/main/app/products/%5Bid%5D/page.tsx): `app/products/[id]/page.tsx`
- [Catalog Components](https://github.com/gvardhan97/next_store/tree/main/components/products): `components/products`

### Customer Features

- [Favorites](https://github.com/gvardhan97/next_store/blob/main/app/favorites/page.tsx): `app/favorites/page.tsx`
- [Reviews](https://github.com/gvardhan97/next_store/blob/main/app/reviews/page.tsx): `app/reviews/page.tsx`
- [Review Submission](https://github.com/gvardhan97/next_store/blob/main/components/reviews/SubmitReview.tsx): `components/reviews/SubmitReview.tsx`

### Cart And Orders

- [Shopping Cart](https://github.com/gvardhan97/next_store/blob/main/app/cart/page.tsx): `app/cart/page.tsx`
- [Checkout Page](https://github.com/gvardhan97/next_store/blob/main/app/checkout/page.tsx): `app/checkout/page.tsx`
- [Payment Session API](https://github.com/gvardhan97/next_store/blob/main/app/api/payment/route.ts): `app/api/payment/route.ts`
- [Payment Confirmation API](https://github.com/gvardhan97/next_store/blob/main/app/api/confirm/route.ts): `app/api/confirm/route.ts`
- [Order History](https://github.com/gvardhan97/next_store/blob/main/app/orders/page.tsx): `app/orders/page.tsx`

### Administration

- [Product Management](https://github.com/gvardhan97/next_store/tree/main/app/admin/products): `app/admin/products`
- [Sales Management](https://github.com/gvardhan97/next_store/blob/main/app/admin/sales/page.tsx): `app/admin/sales/page.tsx`

### Server And Integrations

- [Server Actions](https://github.com/gvardhan97/next_store/blob/main/utils/actions.ts): `utils/actions.ts`
- [Prisma Data Store](https://github.com/gvardhan97/next_store/blob/main/utils/db.ts): `utils/db.ts`
- **Clerk Auth**
- [Supabase Storage](https://github.com/gvardhan97/next_store/blob/main/utils/supabase.ts): `utils/supabase.ts`
- **Stripe**

### Other components

- **Customer**

## Connections

- Customer → Product Catalog: browses
- Customer → Home Page: visits
- Product Catalog → Product Detail: opens product
- Product Catalog → Catalog Components: renders listings (evidence: `app/products/page.tsx`)
- Product Detail → Server Actions: fetches product (evidence: `app/products/[id]/page.tsx`)
- Product Detail → Review Submission: offers review (evidence: `app/products/[id]/page.tsx`)
- Product Detail → Favorites: links favorites
- Customer → Favorites: manages favorites
- Customer → Reviews: manages reviews
- Review Submission → Server Actions: submits review (evidence: `components/reviews/SubmitReview.tsx`)
- Reviews → Server Actions: fetches reviews (evidence: `app/reviews/page.tsx`)
- Customer → Shopping Cart: manages cart
- Shopping Cart → Server Actions: loads cart (evidence: `app/cart/page.tsx`)
- Server Actions → Prisma Data Store: reads and writes (evidence: `utils/actions.ts`)
- Server Actions → Clerk Auth: checks identity (evidence: `utils/actions.ts`)
- Server Actions → Supabase Storage: uploads images (evidence: `utils/actions.ts`)
- Product Management → Server Actions: manages products (evidence: `app/admin/products/page.tsx`)
- Sales Management → Server Actions: fetches sales (evidence: `app/admin/sales/page.tsx`)
- Customer → Checkout Page: starts checkout
- Checkout Page → Payment Session API: requests session
- Payment Session API → Stripe: creates session
- Payment Session API → Prisma Data Store: loads order data (evidence: `app/api/payment/route.ts`)
- Stripe → Payment Confirmation API: confirms payment
- Payment Confirmation API → Prisma Data Store: marks paid (evidence: `app/api/confirm/route.ts`)
- Payment Confirmation API → Prisma Data Store: cleans cart (evidence: `app/api/confirm/route.ts`)
- Customer → Order History: views orders
- Order History → Server Actions: fetches orders (evidence: `app/orders/page.tsx`)
