# elif0luna/ecommerce-admin-main architecture

> Architecture diagram of the GitHub repository elif0luna/ecommerce-admin-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elif0luna/ecommerce-admin-main
- Repository: https://github.com/elif0luna/ecommerce-admin-main

## Overview

Ecommerce Admin is a multi-store commerce dashboard with catalog management, sales reporting, Stripe checkout, and a student-to-student marketplace. Store owners manage catalog data and review incoming marketplace requests; buyers submit requests and track approval and settlement. The graph combines sampled calls with README-documented flows. Several dashboard pages and integrations are unsampled, so their connections are shown only where documentation supports them.

Main entry points: [`lib/prismadb.ts`](https://github.com/elif0luna/ecommerce-admin-main/blob/main/lib/prismadb.ts) (PostgreSQL via Prisma), [`app/(dashboard)/[storeId]/(routes)`](https://github.com/elif0luna/ecommerce-admin-main/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)) (Catalog management), [`app/api/webhook/route.ts`](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/webhook/route.ts) (Payment webhook), [`app/(auth)/(routes)/sign-in/[[...sign-in]]/page.tsx`](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(auth)/(routes)/sign-in/%5B%5B...sign-in%5D%5D/page.tsx) (Sign in and sign up)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and stores"]
  node_auth["Sign in and sign up<br/>[page.tsx]"]
  node_store["Store creation and switching<br/>[store-modal.tsx]"]
  node_dashboard["Store dashboard<br/>[layout.tsx]"]
end

subgraph group_catalog["Store administration"]
  node_catalogui["Catalog management"]
  node_catalogapi["Catalog API"]
  node_images["Image uploads<br/>[image-upload.tsx]"]
  node_cloudinary{{"Cloudinary"}}
end

subgraph group_commerce["Orders and payments"]
  node_reports["Sales reports"]
  node_ordersui["Order review<br/>[page.tsx]"]
  node_checkout["Stripe checkout<br/>[route.ts]"]
  node_webhook["Payment webhook<br/>[route.ts]"]
  node_stripe{{"Stripe<br/>[stripe.ts]"}}
end

subgraph group_market["Student marketplace"]
  node_marketbrowse["Marketplace browsing<br/>[client.tsx]"]
  node_request["Marketplace requests<br/>[route.ts]"]
  node_review["Supplier approval<br/>[client.tsx]"]
  node_myorders["Buyer order tracking<br/>[client.tsx]"]
  node_orderapi["Order status API<br/>[route.ts]"]
end

subgraph group_data["Persistence and services"]
  node_db[("PostgreSQL via Prisma<br/>[prismadb.ts]")]
end

node_owner(("Store owner"))
node_buyer(("Student buyer"))
node_clerk{{"Clerk"}}

node_owner -->|"signs in"| node_auth
node_buyer -->|"signs in"| node_auth
node_auth -->|"authenticates with"| node_clerk
node_owner -->|"creates store"| node_store
node_store -->|"creates store via"| node_db
node_owner -->|"manages store"| node_dashboard
node_dashboard -.->|"opens catalog"| node_catalogui
node_catalogui -.->|"manages catalog through"| node_catalogapi
node_catalogapi -->|"reads and writes"| node_db
node_catalogui -.->|"uploads images"| node_images
node_images -->|"uploads to"| node_cloudinary
node_owner -.->|"views sales"| node_reports
node_reports -->|"queries revenue"| node_db
node_owner -->|"reviews requests"| node_ordersui
node_buyer -->|"browses products"| node_marketbrowse
node_marketbrowse -->|"submits request"| node_request
node_request -->|"records request"| node_db
node_ordersui -->|"reviews and updates"| node_review
node_review -.->|"updates request"| node_db
node_buyer -->|"tracks request"| node_myorders
node_myorders -->|"polls status"| node_orderapi
node_orderapi -->|"reads and updates"| node_db
node_owner -.->|"initiates checkout"| node_checkout
node_checkout -->|"creates checkout session"| node_stripe
node_stripe -->|"sends events"| node_webhook
node_webhook -->|"verifies signature"| node_stripe
node_webhook -->|"marks order paid"| node_db

click node_auth "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(auth)/(routes)/sign-in/%5B%5B...sign-in%5D%5D/page.tsx"
click node_store "https://github.com/elif0luna/ecommerce-admin-main/blob/main/components/modals/store-modal.tsx"
click node_dashboard "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/layout.tsx"
click node_catalogui "https://github.com/elif0luna/ecommerce-admin-main/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)"
click node_catalogapi "https://github.com/elif0luna/ecommerce-admin-main/tree/main/app/api/%5BstoreId%5D"
click node_images "https://github.com/elif0luna/ecommerce-admin-main/blob/main/components/ui/image-upload.tsx"
click node_reports "https://github.com/elif0luna/ecommerce-admin-main/blob/main/actions/get-graph-revenue.ts"
click node_ordersui "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders/page.tsx"
click node_checkout "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/%5BstoreId%5D/checkout/route.ts"
click node_webhook "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/webhook/route.ts"
click node_stripe "https://github.com/elif0luna/ecommerce-admin-main/blob/main/lib/stripe.ts"
click node_marketbrowse "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/marketplace/components/client.tsx"
click node_request "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/marketplace/orders/route.ts"
click node_review "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders/components/client.tsx"
click node_myorders "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/my-orders/components/client.tsx"
click node_orderapi "https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/marketplace/orders/route.ts"
click node_db "https://github.com/elif0luna/ecommerce-admin-main/blob/main/lib/prismadb.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_auth,node_store,node_dashboard toneBlue
class node_catalogui,node_catalogapi,node_images,node_cloudinary toneAmber
class node_reports,node_ordersui,node_checkout,node_webhook,node_stripe toneMint
class node_marketbrowse,node_request,node_review,node_myorders,node_orderapi toneRose
class node_db,node_owner,node_buyer,node_clerk toneIndigo
```

## Components

### Access and stores

- [Sign in and sign up](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(auth)/(routes)/sign-in/%5B%5B...sign-in%5D%5D/page.tsx): `app/(auth)/(routes)/sign-in/[[...sign-in]]/page.tsx`
- [Store creation and switching](https://github.com/elif0luna/ecommerce-admin-main/blob/main/components/modals/store-modal.tsx): `components/modals/store-modal.tsx`
- [Store dashboard](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/layout.tsx): `app/(dashboard)/[storeId]/layout.tsx`

### Store administration

- [Catalog management](https://github.com/elif0luna/ecommerce-admin-main/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)): `app/(dashboard)/[storeId]/(routes)`
- [Catalog API](https://github.com/elif0luna/ecommerce-admin-main/tree/main/app/api/%5BstoreId%5D): `app/api/[storeId]`
- [Image uploads](https://github.com/elif0luna/ecommerce-admin-main/blob/main/components/ui/image-upload.tsx): `components/ui/image-upload.tsx`
- **Cloudinary**

### Orders and payments

- [Sales reports](https://github.com/elif0luna/ecommerce-admin-main/blob/main/actions/get-graph-revenue.ts): `actions/get-graph-revenue.ts`
- [Order review](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders/page.tsx): `app/(dashboard)/[storeId]/(routes)/orders/page.tsx`
- [Stripe checkout](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/%5BstoreId%5D/checkout/route.ts): `app/api/[storeId]/checkout/route.ts`
- [Payment webhook](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/webhook/route.ts): `app/api/webhook/route.ts`
- [Stripe](https://github.com/elif0luna/ecommerce-admin-main/blob/main/lib/stripe.ts): `lib/stripe.ts`

### Student marketplace

- [Marketplace browsing](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/marketplace/components/client.tsx): `app/(dashboard)/[storeId]/(routes)/marketplace/components/client.tsx`
- [Marketplace requests](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/marketplace/orders/route.ts): `app/api/marketplace/orders/route.ts`
- [Supplier approval](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders/components/client.tsx): `app/(dashboard)/[storeId]/(routes)/orders/components/client.tsx`
- [Buyer order tracking](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/my-orders/components/client.tsx): `app/(dashboard)/[storeId]/(routes)/my-orders/components/client.tsx`
- [Order status API](https://github.com/elif0luna/ecommerce-admin-main/blob/main/app/api/marketplace/orders/route.ts): `app/api/marketplace/orders/route.ts`

### Persistence and services

- [PostgreSQL via Prisma](https://github.com/elif0luna/ecommerce-admin-main/blob/main/lib/prismadb.ts): `lib/prismadb.ts`

### Other components

- **Store owner**
- **Student buyer**
- **Clerk**

## Connections

- Store owner → Sign in and sign up: signs in
- Student buyer → Sign in and sign up: signs in
- Sign in and sign up → Clerk: authenticates with
- Store owner → Store creation and switching: creates store (evidence: `components/modals/store-modal.tsx`)
- Store creation and switching → PostgreSQL via Prisma: creates store via
- Store owner → Store dashboard: manages store
- Store dashboard → Catalog management: opens catalog
- Catalog management → Catalog API: manages catalog through
- Catalog API → PostgreSQL via Prisma: reads and writes (evidence: `app/api/[storeId]/products/route.ts`)
- Catalog management → Image uploads: uploads images
- Image uploads → Cloudinary: uploads to
- Store owner → Sales reports: views sales
- Sales reports → PostgreSQL via Prisma: queries revenue (evidence: `actions/get-graph-revenue.ts`)
- Store owner → Order review: reviews requests
- Student buyer → Marketplace browsing: browses products
- Marketplace browsing → Marketplace requests: submits request (evidence: `app/(dashboard)/[storeId]/(routes)/marketplace/components/client.tsx`)
- Marketplace requests → PostgreSQL via Prisma: records request (evidence: `app/api/marketplace/orders/route.ts`)
- Order review → Supplier approval: reviews and updates
- Supplier approval → PostgreSQL via Prisma: updates request
- Student buyer → Buyer order tracking: tracks request
- Buyer order tracking → Order status API: polls status (evidence: `app/(dashboard)/[storeId]/(routes)/my-orders/components/client.tsx`)
- Order status API → PostgreSQL via Prisma: reads and updates (evidence: `app/api/marketplace/orders/route.ts`)
- Store owner → Stripe checkout: initiates checkout
- Stripe checkout → Stripe: creates checkout session (evidence: `app/api/[storeId]/checkout/route.ts`)
- Stripe → Payment webhook: sends events (evidence: `app/api/webhook/route.ts`)
- Payment webhook → Stripe: verifies signature (evidence: `app/api/webhook/route.ts`)
- Payment webhook → PostgreSQL via Prisma: marks order paid (evidence: `app/api/webhook/route.ts`)
