# meriemchm/chm_admin_e-commerce_website architecture

> Architecture diagram of the GitHub repository meriemchm/chm_admin_e-commerce_website, 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/meriemchm/chm_admin_e-commerce_website
- Repository: https://github.com/meriemchm/chm_admin_e-commerce_website

## Overview

This is a multi-store e-commerce administration app built with Next.js, Prisma, and Clerk, with Stripe checkout support. The main workflow is a store administrator managing catalog and store settings through dashboard pages backed by store-scoped API routes and Prisma; orders and dashboard metrics provide operational visibility. Checkout and payment confirmation form a separate transaction path. The tree and README document broad capabilities, but many route implementations were not sampled, so those links are omitted or marked unverified rather than inferred.

Main entry points: [`lib/prismadb.ts`](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/prismadb.ts) (Prisma database), [`app/api/webhook/route.ts`](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/webhook/route.ts) (Payment webhook), [`lib/stripe.ts`](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/stripe.ts) (Stripe payments), [`app/api/[storeId]/checkout/route.ts`](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/%5BstoreId%5D/checkout/route.ts) (Checkout endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and Stores"]
  node_clerk{{"Clerk auth"}}
  node_auth_pages["Sign-in and signup"]
  node_store_pages["Store entry and switching<br/>[page.tsx]"]
  node_store_api["Store API"]
end

subgraph group_admin["Store Administration"]
  node_dashboard["Dashboard shell"]
  node_catalog_ui["Catalog management UI<br/>[client.tsx]"]
  node_catalog_api["Catalog APIs<br/>[route.tsx]"]
  node_taxonomy_api["Catalog attributes APIs"]
  node_billboard_ui["Billboard management UI<br/>[client.tsx]"]
  node_settings_ui["Store settings"]
  node_table["Reusable data table<br/>[data-table.tsx]"]
end

subgraph group_commerce["Commerce Operations"]
  node_orders_ui["Order management UI"]
  node_metrics["Dashboard metrics"]
  node_checkout["Checkout endpoint<br/>[route.ts]"]
  node_webhook["Payment webhook<br/>[route.ts]"]
end

subgraph group_data["Persistence and Integrations"]
  node_payment{{"Stripe payments<br/>[stripe.ts]"}}
  node_database[("Prisma database<br/>[prismadb.ts]")]
end

node_admin_user(("Store administrator"))

node_admin_user -.->|"signs in"| node_auth_pages
node_auth_pages -.->|"authenticates with"| node_clerk
node_admin_user -.->|"manages store"| node_dashboard
node_store_pages -.->|"selects store"| node_store_api
node_catalog_ui -->|"renders"| node_table
node_billboard_ui -->|"renders"| node_table
node_catalog_api -->|"reads and writes"| node_database
node_taxonomy_api -->|"persists entities"| node_database
node_store_api -->|"reads and writes"| node_database
node_metrics -->|"queries metrics"| node_database
node_checkout -->|"creates order"| node_database
node_checkout -->|"starts payment"| node_payment
node_payment -.->|"confirms payment"| node_webhook
node_webhook -->|"verifies event"| node_payment
node_webhook -->|"updates order and products"| node_database

click node_auth_pages "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(auth)/(routes)"
click node_store_pages "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(root)/(routes)/page.tsx"
click node_store_api "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/api/stores"
click node_dashboard "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)"
click node_catalog_ui "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/products/components/client.tsx"
click node_catalog_api "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/%5BstoreId%5D/products/route.tsx"
click node_taxonomy_api "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/api/%5BstoreId%5D"
click node_billboard_ui "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/billboards/components/client.tsx"
click node_settings_ui "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)/settings"
click node_orders_ui "https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders"
click node_metrics "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/actions/get-graph-revenue.ts"
click node_checkout "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/%5BstoreId%5D/checkout/route.ts"
click node_payment "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/stripe.ts"
click node_webhook "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/webhook/route.ts"
click node_database "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/prismadb.ts"
click node_table "https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/components/ui/data-table.tsx"

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_clerk,node_auth_pages,node_store_pages,node_store_api toneBlue
class node_dashboard,node_catalog_ui,node_catalog_api,node_taxonomy_api,node_billboard_ui,node_settings_ui,node_table toneAmber
class node_orders_ui,node_metrics,node_checkout,node_webhook toneMint
class node_payment,node_database toneRose
class node_admin_user toneIndigo
```

## Components

### Identity and Stores

- **Clerk auth**
- [Sign-in and signup](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(auth)/(routes)): `app/(auth)/(routes)`
- [Store entry and switching](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(root)/(routes)/page.tsx): `app/(root)/(routes)/page.tsx`
- [Store API](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/api/stores): `app/api/stores`

### Store Administration

- [Dashboard shell](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)): `app/(dashboard)/[storeId]/(routes)`
- [Catalog management UI](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/products/components/client.tsx): `app/(dashboard)/[storeId]/(routes)/products/components/client.tsx`
- [Catalog APIs](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/%5BstoreId%5D/products/route.tsx): `app/api/[storeId]/products/route.tsx`
- [Catalog attributes APIs](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/api/%5BstoreId%5D): `app/api/[storeId]`
- [Billboard management UI](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/billboards/components/client.tsx): `app/(dashboard)/[storeId]/(routes)/billboards/components/client.tsx`
- [Store settings](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)/settings): `app/(dashboard)/[storeId]/(routes)/settings`
- [Reusable data table](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/components/ui/data-table.tsx): `components/ui/data-table.tsx`

### Commerce Operations

- [Order management UI](https://github.com/meriemchm/chm_admin_e-commerce_website/tree/main/app/(dashboard)/%5BstoreId%5D/(routes)/orders): `app/(dashboard)/[storeId]/(routes)/orders`
- [Dashboard metrics](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/actions/get-graph-revenue.ts): `actions/get-graph-revenue.ts`
- [Checkout endpoint](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/%5BstoreId%5D/checkout/route.ts): `app/api/[storeId]/checkout/route.ts`
- [Payment webhook](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/app/api/webhook/route.ts): `app/api/webhook/route.ts`

### Persistence and Integrations

- [Stripe payments](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/stripe.ts): `lib/stripe.ts`
- [Prisma database](https://github.com/meriemchm/chm_admin_e-commerce_website/blob/main/lib/prismadb.ts): `lib/prismadb.ts`

### Other components

- **Store administrator**

## Connections

- Store administrator → Sign-in and signup: signs in (evidence: `README.md`)
- Sign-in and signup → Clerk auth: authenticates with (evidence: `README.md`)
- Store administrator → Dashboard shell: manages store (evidence: `README.md`)
- Store entry and switching → Store API: selects store
- Catalog management UI → Reusable data table: renders (evidence: `app/(dashboard)/[storeId]/(routes)/products/components/client.tsx`)
- Billboard management UI → Reusable data table: renders (evidence: `app/(dashboard)/[storeId]/(routes)/billboards/components/client.tsx`)
- Catalog APIs → Prisma database: reads and writes (evidence: `app/api/[storeId]/products/route.tsx`)
- Catalog attributes APIs → Prisma database: persists entities (evidence: `app/api/[storeId]/categories/route.tsx`)
- Store API → Prisma database: reads and writes (evidence: `app/api/stores/route.ts`)
- Dashboard metrics → Prisma database: queries metrics (evidence: `actions/get-graph-revenue.ts`)
- Checkout endpoint → Prisma database: creates order (evidence: `app/api/[storeId]/checkout/route.ts`)
- Checkout endpoint → Stripe payments: starts payment (evidence: `app/api/[storeId]/checkout/route.ts`)
- Stripe payments → Payment webhook: confirms payment (evidence: `app/api/webhook/route.ts`)
- Payment webhook → Stripe payments: verifies event (evidence: `app/api/webhook/route.ts`)
- Payment webhook → Prisma database: updates order and products (evidence: `app/api/webhook/route.ts`)
