# hakimov0545/e-commerse architecture

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

- Interactive diagram: https://gitdiagram.com/hakimov0545/e-commerse
- Repository: https://github.com/hakimov0545/e-commerse

## Overview

This repository implements an e-commerce product with a customer storefront, a separate administration interface, and an Express/Mongoose API. Customers browse products and categories, manage accounts and wishlists, and reach product, contact, and payment flows; administrators manage catalog and operational areas. The sampled review and auth code confirms route-to-controller behavior and service/model interactions, including review-driven product-rating updates. Other domain modules are represented from the tree; their internal calls were not sampled, so those links are kept at the route/controller level where applicable.

Main entry points: [`controllers`](https://github.com/hakimov0545/e-commerse/tree/main/controllers) (Commerce controllers), [`models`](https://github.com/hakimov0545/e-commerse/tree/main/models) (Domain models), [`index.js`](https://github.com/hakimov0545/e-commerse/blob/main/index.js) (API server), [`services/auth.service.js`](https://github.com/hakimov0545/e-commerse/blob/main/services/auth.service.js) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_storefront_app["Storefront routes<br/>[App.jsx]"]
  node_storefront_pages["Shopping pages"]
  node_storefront_services["Client API services"]
  node_payment_service["Payment flow<br/>[Payment.jsx]"]
end

subgraph group_admin["Admin console"]
  node_admin_app["Admin application<br/>[App.tsx]"]
  node_admin_pages["Management pages"]
  node_admin_services["Admin API services"]
end

subgraph group_api["API and domain logic"]
  node_api_entry["API server<br/>[index.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_review_routes["Review routes<br/>[review.routes.js]"]
  node_domain_routes["Commerce routes"]
  node_domain_controllers["Commerce controllers"]
  node_domain_services["Commerce services"]
  node_review_service["Review service<br/>[review.service.js]"]
  node_product_service["Product service<br/>[product.service.js]"]
end

subgraph group_identity["Identity and messaging"]
  node_auth_controller["Auth controller<br/>[auth.controller.js]"]
  node_auth_service["Auth service<br/>[auth.service.js]"]
  node_token_service["Token service<br/>[token.service.js]"]
  node_email_service["Email service<br/>[email.service.js]"]
end

subgraph group_persistence["Persistence and files"]
  node_models["Domain models"]
  node_database[("MongoDB")]
  node_file_storage["File storage<br/>[file.service.js]"]
end

node_customer(("Customer"))
node_admin_user(("Administrator"))
node_email_provider["Email provider"]

node_customer -->|"opens"| node_storefront_app
node_storefront_app -->|"routes to"| node_storefront_pages
node_storefront_pages -->|"requests data"| node_storefront_services
node_storefront_services -->|"calls API"| node_api_entry
node_admin_user -->|"opens"| node_admin_app
node_admin_app -->|"routes to"| node_admin_pages
node_admin_pages -->|"requests data"| node_admin_services
node_admin_services -->|"calls API"| node_api_entry
node_api_entry -->|"mounts routes"| node_auth_routes
node_api_entry -->|"mounts routes"| node_review_routes
node_api_entry -->|"mounts routes"| node_domain_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_review_routes -->|"dispatches"| node_domain_controllers
node_domain_routes -->|"dispatches"| node_domain_controllers
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"issues tokens"| node_token_service
node_auth_service -->|"sends codes"| node_email_service
node_auth_service -->|"reads and writes"| node_models
node_token_service -->|"stores tokens"| node_models
node_email_service -.->|"sends email"| node_email_provider
node_domain_controllers -->|"calls"| node_domain_services
node_domain_services -->|"reads and writes"| node_models
node_models -->|"persists"| node_database
node_domain_controllers -->|"review actions"| node_review_service
node_review_service -->|"queries reviews"| node_models
node_domain_controllers -->|"updates ratings"| node_product_service
node_product_service -->|"updates products"| node_models
node_domain_controllers -.->|"handles uploads"| node_file_storage
node_storefront_pages -->|"opens payment"| node_payment_service

click node_storefront_app "https://github.com/hakimov0545/e-commerse/blob/main/client/src/App.jsx"
click node_storefront_pages "https://github.com/hakimov0545/e-commerse/tree/main/client/src/pages"
click node_storefront_services "https://github.com/hakimov0545/e-commerse/tree/main/client/src/service"
click node_admin_app "https://github.com/hakimov0545/e-commerse/blob/main/admin/src/App.tsx"
click node_admin_pages "https://github.com/hakimov0545/e-commerse/tree/main/admin/src/pages"
click node_admin_services "https://github.com/hakimov0545/e-commerse/tree/main/admin/src/services"
click node_api_entry "https://github.com/hakimov0545/e-commerse/blob/main/index.js"
click node_auth_routes "https://github.com/hakimov0545/e-commerse/blob/main/routes/auth.routes.js"
click node_review_routes "https://github.com/hakimov0545/e-commerse/blob/main/routes/review.routes.js"
click node_domain_routes "https://github.com/hakimov0545/e-commerse/tree/main/routes"
click node_auth_controller "https://github.com/hakimov0545/e-commerse/blob/main/controllers/auth.controller.js"
click node_auth_service "https://github.com/hakimov0545/e-commerse/blob/main/services/auth.service.js"
click node_token_service "https://github.com/hakimov0545/e-commerse/blob/main/services/token.service.js"
click node_email_service "https://github.com/hakimov0545/e-commerse/blob/main/services/email.service.js"
click node_domain_controllers "https://github.com/hakimov0545/e-commerse/tree/main/controllers"
click node_domain_services "https://github.com/hakimov0545/e-commerse/tree/main/services"
click node_review_service "https://github.com/hakimov0545/e-commerse/blob/main/services/review.service.js"
click node_product_service "https://github.com/hakimov0545/e-commerse/blob/main/services/product.service.js"
click node_models "https://github.com/hakimov0545/e-commerse/tree/main/models"
click node_file_storage "https://github.com/hakimov0545/e-commerse/blob/main/services/file.service.js"
click node_payment_service "https://github.com/hakimov0545/e-commerse/blob/main/client/src/pages/payment/Payment.jsx"

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_storefront_app,node_storefront_pages,node_storefront_services,node_payment_service toneBlue
class node_admin_app,node_admin_pages,node_admin_services toneAmber
class node_api_entry,node_auth_routes,node_review_routes,node_domain_routes,node_domain_controllers,node_domain_services,node_review_service,node_product_service toneMint
class node_auth_controller,node_auth_service,node_token_service,node_email_service toneRose
class node_models,node_database,node_file_storage,node_customer,node_admin_user,node_email_provider toneIndigo
```

## Components

### Customer storefront

- [Storefront routes](https://github.com/hakimov0545/e-commerse/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Shopping pages](https://github.com/hakimov0545/e-commerse/tree/main/client/src/pages): `client/src/pages`
- [Client API services](https://github.com/hakimov0545/e-commerse/tree/main/client/src/service): `client/src/service`
- [Payment flow](https://github.com/hakimov0545/e-commerse/blob/main/client/src/pages/payment/Payment.jsx): `client/src/pages/payment/Payment.jsx`

### Admin console

- [Admin application](https://github.com/hakimov0545/e-commerse/blob/main/admin/src/App.tsx): `admin/src/App.tsx`
- [Management pages](https://github.com/hakimov0545/e-commerse/tree/main/admin/src/pages): `admin/src/pages`
- [Admin API services](https://github.com/hakimov0545/e-commerse/tree/main/admin/src/services): `admin/src/services`

### API and domain logic

- [API server](https://github.com/hakimov0545/e-commerse/blob/main/index.js): `index.js`
- [Auth routes](https://github.com/hakimov0545/e-commerse/blob/main/routes/auth.routes.js): `routes/auth.routes.js`
- [Review routes](https://github.com/hakimov0545/e-commerse/blob/main/routes/review.routes.js): `routes/review.routes.js`
- [Commerce routes](https://github.com/hakimov0545/e-commerse/tree/main/routes): `routes`
- [Commerce controllers](https://github.com/hakimov0545/e-commerse/tree/main/controllers): `controllers`
- [Commerce services](https://github.com/hakimov0545/e-commerse/tree/main/services): `services`
- [Review service](https://github.com/hakimov0545/e-commerse/blob/main/services/review.service.js): `services/review.service.js`
- [Product service](https://github.com/hakimov0545/e-commerse/blob/main/services/product.service.js): `services/product.service.js`

### Identity and messaging

- [Auth controller](https://github.com/hakimov0545/e-commerse/blob/main/controllers/auth.controller.js): `controllers/auth.controller.js`
- [Auth service](https://github.com/hakimov0545/e-commerse/blob/main/services/auth.service.js): `services/auth.service.js`
- [Token service](https://github.com/hakimov0545/e-commerse/blob/main/services/token.service.js): `services/token.service.js`
- [Email service](https://github.com/hakimov0545/e-commerse/blob/main/services/email.service.js): `services/email.service.js`

### Persistence and files

- [Domain models](https://github.com/hakimov0545/e-commerse/tree/main/models): `models`
- **MongoDB**
- [File storage](https://github.com/hakimov0545/e-commerse/blob/main/services/file.service.js): `services/file.service.js`

### Other components

- **Customer**
- **Administrator**
- **Email provider**

## Connections

- Customer → Storefront routes: opens
- Storefront routes → Shopping pages: routes to
- Shopping pages → Client API services: requests data
- Client API services → API server: calls API
- Administrator → Admin application: opens
- Admin application → Management pages: routes to
- Management pages → Admin API services: requests data
- Admin API services → API server: calls API
- API server → Auth routes: mounts routes
- API server → Review routes: mounts routes
- API server → Commerce routes: mounts routes
- Auth routes → Auth controller: dispatches
- Review routes → Commerce controllers: dispatches
- Commerce routes → Commerce controllers: dispatches
- Auth controller → Auth service: calls
- Auth service → Token service: issues tokens
- Auth service → Email service: sends codes
- Auth service → Domain models: reads and writes
- Token service → Domain models: stores tokens
- Email service → Email provider: sends email
- Commerce controllers → Commerce services: calls
- Commerce services → Domain models: reads and writes
- Domain models → MongoDB: persists
- Commerce controllers → Review service: review actions
- Review service → Domain models: queries reviews
- Commerce controllers → Product service: updates ratings
- Product service → Domain models: updates products
- Commerce controllers → File storage: handles uploads
- Shopping pages → Payment flow: opens payment
