# lindsey5/kdmotoshop architecture

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

- Interactive diagram: https://gitdiagram.com/lindsey5/kdmotoshop
- Repository: https://github.com/lindsey5/kdmotoshop

## Overview

KD Motoshop is an e-commerce and shop-management application. Customers browse products, maintain a cart, place and track orders, and can review products or request refunds; administrators manage inventory, orders, suppliers, purchasing, and sales. The backend exposes these capabilities through Express routes and controllers, with MongoDB models holding domain data. The tree and sampled files establish the broad subsystems, but most page-to-API and controller-to-model wiring was not sampled, so those uncertain links are omitted. The README is empty.

Main entry points: [`frontend/src/App.tsx`](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/App.tsx) (Frontend app), [`backend/controllers/orderController.ts`](https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/orderController.ts) (Order controller), [`backend/app.ts`](https://github.com/lindsey5/kdmotoshop/blob/main/backend/app.ts) (Express application), [`backend/controllers/reviewController.ts`](https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/reviewController.ts) (Review controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_app["Frontend app<br/>[App.tsx]"]
  node_catalog["Product catalog<br/>[Products.tsx]"]
  node_cart_checkout["Cart and checkout<br/>[Checkout.tsx]"]
  node_customer_orders["Customer orders<br/>[Orders.tsx]"]
  node_customer_profile["Customer profile"]
  node_reviews_refunds["Reviews and refunds<br/>[CreateRefund.tsx]"]
end

subgraph group_admin["Shop administration"]
  node_admin_dashboard["Dashboard and sales<br/>[Dashboard.tsx]"]
  node_admin_catalog["Catalog and inventory<br/>[Products.tsx]"]
  node_admin_orders["Order management<br/>[Orders.tsx]"]
  node_purchasing["Suppliers and purchasing<br/>[PurchaseOrders.tsx]"]
  node_admin_tools["Admin tools<br/>[Refunds.tsx]"]
end

subgraph group_backend["Backend API"]
  node_http_app["Express application<br/>[app.ts]"]
  node_product_routes["Product routes<br/>[productRoutes.ts]"]
  node_order_routes["Order routes<br/>[orderRoutes.ts]"]
  node_review_routes["Review routes<br/>[reviewRoutes.ts]"]
  node_order_controller["Order controller<br/>[orderController.ts]"]
  node_review_controller["Review controller"]
  node_product_service["Product API client<br/>[productService.tsx]"]
end

subgraph group_services["Domain services"]
  node_order_service["Order service<br/>[orderService.ts]"]
  node_notifications["Notifications"]
  node_email["Email service<br/>[emailService.ts]"]
  node_activity["Activity logging"]
end

subgraph group_integrations["External services"]
  node_database[("MongoDB")]
  node_paymongo["PayMongo"]
  node_cloudinary["Cloudinary"]
  node_brevo["Brevo email"]
end

node_customer(("Customer"))
node_admin_actor(("Administrator"))

node_customer -->|"uses storefront"| node_app
node_admin_actor -->|"uses admin"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_cart_checkout
node_app -->|"routes to"| node_customer_orders
node_app -->|"routes to"| node_customer_profile
node_app -->|"routes to"| node_reviews_refunds
node_app -->|"routes to"| node_admin_dashboard
node_app -->|"routes to"| node_admin_catalog
node_app -->|"routes to"| node_admin_orders
node_app -->|"routes to"| node_purchasing
node_app -->|"routes to"| node_admin_tools
node_product_service -->|"sends product requests"| node_http_app
node_http_app -->|"mounts at API"| node_product_routes
node_http_app -->|"mounts at API"| node_order_routes
node_http_app -->|"mounts at API"| node_review_routes
node_review_routes -->|"dispatches"| node_review_controller
node_order_routes -->|"dispatches"| node_order_controller
node_order_controller -->|"creates orders"| node_order_service
node_order_controller -->|"logs changes"| node_activity
node_order_controller -->|"notifies users"| node_notifications
node_order_controller -->|"emails updates"| node_email
node_review_controller -->|"uploads images"| node_cloudinary
node_review_controller -->|"notifies admins"| node_notifications
node_order_controller -->|"reads and writes"| node_database
node_review_controller -->|"reads and writes"| node_database
node_email -->|"sends email"| node_brevo
node_http_app -.->|"receives webhook"| node_paymongo

click node_app "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/App.tsx"
click node_catalog "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Product/Products.tsx"
click node_cart_checkout "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Order/Checkout.tsx"
click node_customer_orders "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Order/Orders.tsx"
click node_customer_profile "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Profile/CustomerProfile.tsx"
click node_reviews_refunds "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/ui/CreateRefund.tsx"
click node_admin_dashboard "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Dashboard/Dashboard.tsx"
click node_admin_catalog "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Product/Products.tsx"
click node_admin_orders "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Order/Orders.tsx"
click node_purchasing "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/PurchaseOrders/PurchaseOrders.tsx"
click node_admin_tools "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Refunds/Refunds.tsx"
click node_http_app "https://github.com/lindsey5/kdmotoshop/blob/main/backend/app.ts"
click node_product_routes "https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/productRoutes.ts"
click node_order_routes "https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/orderRoutes.ts"
click node_review_routes "https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/reviewRoutes.ts"
click node_order_controller "https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/orderController.ts"
click node_review_controller "https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/reviewController.ts"
click node_product_service "https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/services/productService.tsx"
click node_order_service "https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/orderService.ts"
click node_notifications "https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/notificationService.ts"
click node_email "https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/emailService.ts"
click node_activity "https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/activityLogServices.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_app,node_catalog,node_cart_checkout,node_customer_orders,node_customer_profile,node_reviews_refunds toneBlue
class node_admin_dashboard,node_admin_catalog,node_admin_orders,node_purchasing,node_admin_tools toneAmber
class node_http_app,node_product_routes,node_order_routes,node_review_routes,node_order_controller,node_review_controller,node_product_service toneMint
class node_order_service,node_notifications,node_email,node_activity toneRose
class node_database,node_paymongo,node_cloudinary,node_brevo,node_customer,node_admin_actor toneIndigo
```

## Components

### Customer storefront

- [Frontend app](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Product catalog](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Product/Products.tsx): `frontend/src/pages/customer/Product/Products.tsx`
- [Cart and checkout](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Order/Checkout.tsx): `frontend/src/pages/customer/Order/Checkout.tsx`
- [Customer orders](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Order/Orders.tsx): `frontend/src/pages/customer/Order/Orders.tsx`
- [Customer profile](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/Profile/CustomerProfile.tsx): `frontend/src/pages/customer/Profile/CustomerProfile.tsx`
- [Reviews and refunds](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/customer/ui/CreateRefund.tsx): `frontend/src/pages/customer/ui/CreateRefund.tsx`

### Shop administration

- [Dashboard and sales](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Dashboard/Dashboard.tsx): `frontend/src/pages/admin/Dashboard/Dashboard.tsx`
- [Catalog and inventory](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Product/Products.tsx): `frontend/src/pages/admin/Product/Products.tsx`
- [Order management](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Order/Orders.tsx): `frontend/src/pages/admin/Order/Orders.tsx`
- [Suppliers and purchasing](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/PurchaseOrders/PurchaseOrders.tsx): `frontend/src/pages/admin/PurchaseOrders/PurchaseOrders.tsx`
- [Admin tools](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/pages/admin/Refunds/Refunds.tsx): `frontend/src/pages/admin/Refunds/Refunds.tsx`

### Backend API

- [Express application](https://github.com/lindsey5/kdmotoshop/blob/main/backend/app.ts): `backend/app.ts`
- [Product routes](https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/productRoutes.ts): `backend/routes/productRoutes.ts`
- [Order routes](https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/orderRoutes.ts): `backend/routes/orderRoutes.ts`
- [Review routes](https://github.com/lindsey5/kdmotoshop/blob/main/backend/routes/reviewRoutes.ts): `backend/routes/reviewRoutes.ts`
- [Order controller](https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/orderController.ts): `backend/controllers/orderController.ts`
- [Review controller](https://github.com/lindsey5/kdmotoshop/blob/main/backend/controllers/reviewController.ts): `backend/controllers/reviewController.ts`
- [Product API client](https://github.com/lindsey5/kdmotoshop/blob/main/frontend/src/services/productService.tsx): `frontend/src/services/productService.tsx`

### Domain services

- [Order service](https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/orderService.ts): `backend/services/orderService.ts`
- [Notifications](https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/notificationService.ts): `backend/services/notificationService.ts`
- [Email service](https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/emailService.ts): `backend/services/emailService.ts`
- [Activity logging](https://github.com/lindsey5/kdmotoshop/blob/main/backend/services/activityLogServices.ts): `backend/services/activityLogServices.ts`

### External services

- **MongoDB**
- **PayMongo**
- **Cloudinary**
- **Brevo email**

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Frontend app: uses storefront
- Administrator → Frontend app: uses admin
- Frontend app → Product catalog: routes to
- Frontend app → Cart and checkout: routes to
- Frontend app → Customer orders: routes to
- Frontend app → Customer profile: routes to
- Frontend app → Reviews and refunds: routes to
- Frontend app → Dashboard and sales: routes to
- Frontend app → Catalog and inventory: routes to
- Frontend app → Order management: routes to
- Frontend app → Suppliers and purchasing: routes to
- Frontend app → Admin tools: routes to
- Product API client → Express application: sends product requests
- Express application → Product routes: mounts at API
- Express application → Order routes: mounts at API
- Express application → Review routes: mounts at API
- Review routes → Review controller: dispatches
- Order routes → Order controller: dispatches
- Order controller → Order service: creates orders
- Order controller → Activity logging: logs changes
- Order controller → Notifications: notifies users
- Order controller → Email service: emails updates
- Review controller → Cloudinary: uploads images
- Review controller → Notifications: notifies admins
- Order controller → MongoDB: reads and writes
- Review controller → MongoDB: reads and writes
- Email service → Brevo email: sends email
- Express application → PayMongo: receives webhook
