# titya-yem/e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/titya-yem/e-commerce
- Repository: https://github.com/titya-yem/e-commerce

## Overview

This is a pet-focused e-commerce application with a React storefront and dashboards backed by an Express/MongoDB API. The primary user flow is browse products, inspect details, manage a cart, and proceed through Stripe checkout; other major workflows cover authentication, appointments, services, comments, and administration. The frontend entry point documents route composition, while the sampled backend code shows service, appointment, comment, and authentication handling. Some controllers, routes, and payment wiring were not sampled, so their connections are omitted or marked unverified.

Main entry points: [`frontend/src/main.tsx`](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/main.tsx) (App routes), [`backend/src/controllers/service.controller.ts`](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/service.controller.ts) (Service API), [`frontend/src/pages/Dashboard/admin/AdminComments.tsx`](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminComments.tsx) (Comment dashboards), [`frontend/src/pages/ShopPage.tsx`](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/ShopPage.tsx) (Shop catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app_routes["App routes<br/>[main.tsx]"]
  node_shop_catalog["Shop catalog<br/>[ShopPage.tsx]"]
  node_product_details["Product details<br/>[ProductDetails.tsx]"]
  node_cart["Cart<br/>[Cart.tsx]"]
  node_checkout["Stripe checkout"]
end

subgraph group_identity["Identity"]
  node_auth_ui["Sign-in and signup<br/>[SignInPage.tsx]"]
end

subgraph group_operations["User Operations"]
  node_appointment_ui["Appointment booking"]
  node_contact_ui["Contact form<br/>[ContactPage.tsx]"]
  node_service_catalog["Service catalog<br/>[Services.tsx]"]
end

subgraph group_admin["Administration"]
  node_service_admin["Service administration<br/>[AdminServices.tsx]"]
  node_comment_pages["Comment dashboards<br/>[AdminComments.tsx]"]
  node_admin_dashboard["Admin dashboard"]
  node_admin_orders["Order management<br/>[AdminOrders.tsx]"]
  node_user_dashboard["User dashboard<br/>[UserDashboard.tsx]"]
end

subgraph group_backend["API and Data"]
  node_auth_api["Authentication<br/>[auth.controller.ts]"]
  node_auth_guard["JWT middleware<br/>[auth.middleware.ts]"]
  node_user_model[("User records<br/>[user.model.ts]")]
  node_appointment_api["Appointment management"]
  node_appointment_model[("Appointment records")]
  node_service_api["Service API"]
  node_service_routes["Service routes<br/>[service.route.ts]"]
  node_service_model[("Service records<br/>[service.model.ts]")]
  node_comment_api["Comment moderation"]
  node_comment_model[("Comment records<br/>[comment.model.ts]")]
  node_orders_api["Order handling"]
  node_products_api["Product handling"]
  node_analytics_api["Admin analytics"]
end

node_shopper(("Shopper"))
node_admin_actor(("Administrator"))
node_mongodb[("MongoDB")]
node_stripe(("Stripe"))

node_shopper -->|"opens"| node_app_routes
node_app_routes -->|"routes to"| node_shop_catalog
node_app_routes -->|"routes to"| node_product_details
node_app_routes -->|"routes to"| node_cart
node_shopper -->|"signs up"| node_auth_ui
node_auth_ui -.->|"submits credentials"| node_auth_api
node_auth_api -->|"reads and updates"| node_user_model
node_auth_guard -.->|"checks token identity"| node_user_model
node_shopper -->|"books"| node_appointment_ui
node_appointment_ui -.->|"submits booking"| node_appointment_api
node_appointment_api -->|"creates and queries"| node_appointment_model
node_shopper -->|"sends inquiry"| node_contact_ui
node_shopper -->|"browses"| node_service_catalog
node_service_admin -->|"updates services"| node_service_api
node_service_routes -->|"dispatches"| node_service_api
node_service_api -->|"reads and writes"| node_service_model
node_service_api -->|"persists records"| node_mongodb
node_shopper -.->|"manages comments"| node_comment_pages
node_admin_actor -->|"moderates"| node_comment_pages
node_comment_pages -.->|"requests moderation"| node_comment_api
node_comment_api -->|"reads and updates"| node_comment_model
node_admin_actor -->|"views analytics"| node_admin_dashboard
node_admin_actor -->|"manages orders"| node_admin_orders
node_shopper -->|"views account"| node_user_dashboard
node_admin_orders -.->|"requests orders"| node_orders_api
node_cart -.->|"starts checkout"| node_checkout
node_checkout -.->|"creates payment"| node_stripe
node_shop_catalog -.->|"loads products"| node_products_api
node_admin_dashboard -.->|"loads analytics"| node_analytics_api

click node_app_routes "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/main.tsx"
click node_shop_catalog "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/ShopPage.tsx"
click node_product_details "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/ProductDetails.tsx"
click node_cart "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/Cart.tsx"
click node_checkout "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/payment.controller.ts"
click node_auth_ui "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/SignInPage.tsx"
click node_auth_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/auth.controller.ts"
click node_auth_guard "https://github.com/titya-yem/e-commerce/blob/main/backend/src/middlewares/auth.middleware.ts"
click node_user_model "https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/user.model.ts"
click node_appointment_ui "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/AppointmentPage.tsx"
click node_appointment_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/appointment.controller.ts"
click node_appointment_model "https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/appointment.model.ts"
click node_contact_ui "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/ContactPage.tsx"
click node_service_catalog "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/Services.tsx"
click node_service_admin "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminServices.tsx"
click node_service_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/service.controller.ts"
click node_service_routes "https://github.com/titya-yem/e-commerce/blob/main/backend/src/routes/service.route.ts"
click node_service_model "https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/service.model.ts"
click node_comment_pages "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminComments.tsx"
click node_comment_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/comment.controller.ts"
click node_comment_model "https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/comment.model.ts"
click node_admin_dashboard "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminDashboardPage.tsx"
click node_admin_orders "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminOrders.tsx"
click node_user_dashboard "https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/user/UserDashboard.tsx"
click node_orders_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/order.controller.ts"
click node_products_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/product.controller.ts"
click node_analytics_api "https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/adminAnalytics.controller.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_routes,node_shop_catalog,node_product_details,node_cart,node_checkout toneBlue
class node_auth_ui,node_mongodb toneAmber
class node_appointment_ui,node_contact_ui,node_service_catalog toneMint
class node_service_admin,node_comment_pages,node_admin_dashboard,node_admin_orders,node_user_dashboard toneRose
class node_auth_api,node_auth_guard,node_user_model,node_appointment_api,node_appointment_model,node_service_api,node_service_routes,node_service_model,node_comment_api,node_comment_model,node_orders_api,node_products_api,node_analytics_api,node_shopper,node_admin_actor,node_stripe toneIndigo
```

## Components

### Storefront

- [App routes](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Shop catalog](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/ShopPage.tsx): `frontend/src/pages/ShopPage.tsx`
- [Product details](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/ProductDetails.tsx): `frontend/src/components/ProductDetails.tsx`
- [Cart](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/Cart.tsx): `frontend/src/components/Cart.tsx`
- [Stripe checkout](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/payment.controller.ts): `backend/src/controllers/payment.controller.ts`

### Identity

- [Sign-in and signup](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/SignInPage.tsx): `frontend/src/pages/SignInPage.tsx`

### User Operations

- [Appointment booking](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/AppointmentPage.tsx): `frontend/src/pages/AppointmentPage.tsx`
- [Contact form](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/ContactPage.tsx): `frontend/src/pages/ContactPage.tsx`
- [Service catalog](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/components/Services.tsx): `frontend/src/components/Services.tsx`

### Administration

- [Service administration](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminServices.tsx): `frontend/src/pages/Dashboard/admin/AdminServices.tsx`
- [Comment dashboards](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminComments.tsx): `frontend/src/pages/Dashboard/admin/AdminComments.tsx`
- [Admin dashboard](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminDashboardPage.tsx): `frontend/src/pages/Dashboard/admin/AdminDashboardPage.tsx`
- [Order management](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/admin/AdminOrders.tsx): `frontend/src/pages/Dashboard/admin/AdminOrders.tsx`
- [User dashboard](https://github.com/titya-yem/e-commerce/blob/main/frontend/src/pages/Dashboard/user/UserDashboard.tsx): `frontend/src/pages/Dashboard/user/UserDashboard.tsx`

### API and Data

- [Authentication](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/auth.controller.ts): `backend/src/controllers/auth.controller.ts`
- [JWT middleware](https://github.com/titya-yem/e-commerce/blob/main/backend/src/middlewares/auth.middleware.ts): `backend/src/middlewares/auth.middleware.ts`
- [User records](https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/user.model.ts): `backend/src/models/user.model.ts`
- [Appointment management](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/appointment.controller.ts): `backend/src/controllers/appointment.controller.ts`
- [Appointment records](https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/appointment.model.ts): `backend/src/models/appointment.model.ts`
- [Service API](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/service.controller.ts): `backend/src/controllers/service.controller.ts`
- [Service routes](https://github.com/titya-yem/e-commerce/blob/main/backend/src/routes/service.route.ts): `backend/src/routes/service.route.ts`
- [Service records](https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/service.model.ts): `backend/src/models/service.model.ts`
- [Comment moderation](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/comment.controller.ts): `backend/src/controllers/comment.controller.ts`
- [Comment records](https://github.com/titya-yem/e-commerce/blob/main/backend/src/models/comment.model.ts): `backend/src/models/comment.model.ts`
- [Order handling](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/order.controller.ts): `backend/src/controllers/order.controller.ts`
- [Product handling](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/product.controller.ts): `backend/src/controllers/product.controller.ts`
- [Admin analytics](https://github.com/titya-yem/e-commerce/blob/main/backend/src/controllers/adminAnalytics.controller.ts): `backend/src/controllers/adminAnalytics.controller.ts`

### Other components

- **Shopper**
- **Administrator**
- **MongoDB**
- **Stripe**

## Connections

- Shopper → App routes: opens (evidence: `frontend/src/main.tsx`)
- App routes → Shop catalog: routes to (evidence: `frontend/src/main.tsx`)
- App routes → Product details: routes to (evidence: `frontend/src/main.tsx`)
- App routes → Cart: routes to (evidence: `frontend/src/main.tsx`)
- Shopper → Sign-in and signup: signs up
- Sign-in and signup → Authentication: submits credentials
- Authentication → User records: reads and updates (evidence: `backend/src/controllers/auth.controller.ts`)
- JWT middleware → User records: checks token identity
- Shopper → Appointment booking: books
- Appointment booking → Appointment management: submits booking
- Appointment management → Appointment records: creates and queries (evidence: `backend/src/controllers/appointment.controller.ts`)
- Shopper → Contact form: sends inquiry
- Shopper → Service catalog: browses
- Service administration → Service API: updates services (evidence: `frontend/src/pages/Dashboard/admin/AdminServices.tsx`)
- Service routes → Service API: dispatches (evidence: `backend/src/routes/service.route.ts`)
- Service API → Service records: reads and writes (evidence: `backend/src/controllers/service.controller.ts`)
- Service API → MongoDB: persists records
- Shopper → Comment dashboards: manages comments
- Administrator → Comment dashboards: moderates
- Comment dashboards → Comment moderation: requests moderation
- Comment moderation → Comment records: reads and updates (evidence: `backend/src/controllers/comment.controller.ts`)
- Administrator → Admin dashboard: views analytics
- Administrator → Order management: manages orders
- Shopper → User dashboard: views account
- Order management → Order handling: requests orders
- Cart → Stripe checkout: starts checkout
- Stripe checkout → Stripe: creates payment
- Shop catalog → Product handling: loads products
- Admin dashboard → Admin analytics: loads analytics
