# haibarca03/vietglobal architecture

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

- Interactive diagram: https://gitdiagram.com/haibarca03/vietglobal
- Repository: https://github.com/haibarca03/vietglobal

## Overview

VietGlobal combines a multilingual logistics and shipping-services storefront with a product catalog, administrator-managed content, user authentication, and contact email handling. Visitors enter through localized routes to explore logistics services or browse product categories and details; administrators manage catalog and site content through protected operations. The sampled files show the product API’s storage and image-upload behavior, while other backend domains and frontend API flows are represented where the source index documents them. Several page and route implementations were not sampled, so their internal behavior is not expanded.

Main entry points: [`frontend/src/router/routes.js`](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/router/routes.js) (Localized pages), [`backend/src/controller/product.controller.js`](https://github.com/haibarca03/vietglobal/blob/main/backend/src/controller/product.controller.js) (Product operations), [`backend/src/routers/index.router.js`](https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/index.router.js) (API route registry), [`backend/src/routers/product.router.js`](https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/product.router.js) (Product routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront"]
  node_app["Web app routing<br/>[App.jsx]"]
  node_routes["Localized pages<br/>[routes.js]"]
  node_shipping["Shipping pages"]
  node_service_detail["Service detail"]
  node_service_content["Service presentation<br/>[ServiceContent.jsx]"]
  node_fulfillment["Fulfillment"]
end

subgraph group_catalog["Product catalog"]
  node_catalog_pages["Catalog pages"]
  node_product_detail["Product detail"]
  node_product_client["Product API client<br/>[productApi.js]"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin pages"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_user_client["User API client<br/>[userApis.js]"]
end

subgraph group_backend["Backend services"]
  node_backend_entry["HTTP server entry<br/>[index.js]"]
  node_api_routes["API route registry<br/>[index.router.js]"]
  node_product_routes["Product routes<br/>[product.router.js]"]
  node_product_controller["Product operations"]
  node_product_store[("Product records<br/>[product.model.js]")]
  node_category_store[("Category records<br/>[category.model.js]")]
  node_content_routes["Content routes"]
  node_content_controllers["Site content operations"]
  node_auth["Admin authorization<br/>[auth.js]"]
end

subgraph group_messaging["Contact messaging"]
  node_contact["Contact form handler"]
  node_mail_service["Email service<br/>[mail.service.js]"]
  node_email_templates["Email templates<br/>[emailtemplates.js]"]
end

node_visitor(("Visitor"))
node_admin_user(("Administrator"))
node_brevo["Brevo email"]
node_database[("MongoDB<br/>[db.config.js]")]
node_cloudinary["Cloudinary"]

node_visitor -->|"opens"| node_app
node_app -->|"renders routes"| node_routes
node_visitor -->|"browses"| node_shipping
node_routes -->|"routes to"| node_shipping
node_routes -->|"routes to"| node_service_detail
node_service_detail -->|"renders"| node_service_content
node_routes -->|"routes to"| node_fulfillment
node_visitor -->|"browses"| node_catalog_pages
node_routes -->|"routes to"| node_catalog_pages
node_routes -->|"routes to"| node_product_detail
node_product_detail -->|"requests product"| node_product_client
node_admin_user -->|"manages content"| node_admin_pages
node_routes -->|"routes to"| node_admin_pages
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_register
node_login -->|"uses"| node_user_client
node_backend_entry -->|"mounts"| node_api_routes
node_api_routes -->|"registers"| node_product_routes
node_api_routes -->|"registers"| node_content_routes
node_product_routes -->|"dispatches"| node_product_controller
node_product_routes -->|"protects writes"| node_auth
node_product_controller -->|"reads and writes"| node_product_store
node_product_controller -->|"updates categories"| node_category_store
node_product_controller -->|"uploads images"| node_cloudinary
node_content_routes -->|"dispatches"| node_content_controllers
node_content_routes -->|"protects writes"| node_auth
node_backend_entry -->|"connects"| node_database
node_contact -->|"sends contact data"| node_mail_service
node_mail_service -->|"fills templates"| node_email_templates
node_mail_service -->|"sends email"| node_brevo

click node_app "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/App.jsx"
click node_routes "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/router/routes.js"
click node_shipping "https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/Shipping"
click node_service_detail "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Shipping/ServiceDetailPage.jsx"
click node_service_content "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/components/ServiceDetail/ServiceContent.jsx"
click node_fulfillment "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Fulfillment/FulfillmentPage.jsx"
click node_catalog_pages "https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/ProductCategory"
click node_product_detail "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/ProductDetailPage/ProductDetailPage.jsx"
click node_product_client "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/stores/Product/productApi.js"
click node_admin_pages "https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/Admin"
click node_login "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Login/Login.jsx"
click node_register "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Register/Register.jsx"
click node_user_client "https://github.com/haibarca03/vietglobal/blob/main/frontend/src/stores/Users/userApis.js"
click node_backend_entry "https://github.com/haibarca03/vietglobal/blob/main/backend/index.js"
click node_api_routes "https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/index.router.js"
click node_product_routes "https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/product.router.js"
click node_product_controller "https://github.com/haibarca03/vietglobal/blob/main/backend/src/controller/product.controller.js"
click node_product_store "https://github.com/haibarca03/vietglobal/blob/main/backend/src/models/product.model.js"
click node_category_store "https://github.com/haibarca03/vietglobal/blob/main/backend/src/models/category.model.js"
click node_content_routes "https://github.com/haibarca03/vietglobal/tree/main/backend/src/routers"
click node_content_controllers "https://github.com/haibarca03/vietglobal/tree/main/backend/src/controller"
click node_auth "https://github.com/haibarca03/vietglobal/blob/main/backend/src/middleware/auth.js"
click node_contact "https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/mailer.controller.js"
click node_mail_service "https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/mail.service.js"
click node_email_templates "https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/emailtemplates.js"
click node_brevo "https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/brevo-mail.config.js"
click node_database "https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/db.config.js"
click node_cloudinary "https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/cloudinary.config.js"

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_routes,node_shipping,node_service_detail,node_service_content,node_fulfillment toneBlue
class node_catalog_pages,node_product_detail,node_product_client,node_database toneAmber
class node_admin_pages,node_login,node_register,node_user_client toneMint
class node_backend_entry,node_api_routes,node_product_routes,node_product_controller,node_product_store,node_category_store,node_content_routes,node_content_controllers,node_auth toneRose
class node_contact,node_mail_service,node_email_templates,node_visitor,node_admin_user toneIndigo
class node_brevo,node_cloudinary toneTeal
```

## Components

### Storefront

- [Web app routing](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Localized pages](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/router/routes.js): `frontend/src/router/routes.js`
- [Shipping pages](https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/Shipping): `frontend/src/pages/Shipping`
- [Service detail](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Shipping/ServiceDetailPage.jsx): `frontend/src/pages/Shipping/ServiceDetailPage.jsx`
- [Service presentation](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/components/ServiceDetail/ServiceContent.jsx): `frontend/src/components/ServiceDetail/ServiceContent.jsx`
- [Fulfillment](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Fulfillment/FulfillmentPage.jsx): `frontend/src/pages/Fulfillment/FulfillmentPage.jsx`

### Product catalog

- [Catalog pages](https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/ProductCategory): `frontend/src/pages/ProductCategory`
- [Product detail](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/ProductDetailPage/ProductDetailPage.jsx): `frontend/src/pages/ProductDetailPage/ProductDetailPage.jsx`
- [Product API client](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/stores/Product/productApi.js): `frontend/src/stores/Product/productApi.js`

### Administration

- [Admin pages](https://github.com/haibarca03/vietglobal/tree/main/frontend/src/pages/Admin): `frontend/src/pages/Admin`
- [Login](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Login/Login.jsx): `frontend/src/pages/Login/Login.jsx`
- [Registration](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/pages/Register/Register.jsx): `frontend/src/pages/Register/Register.jsx`
- [User API client](https://github.com/haibarca03/vietglobal/blob/main/frontend/src/stores/Users/userApis.js): `frontend/src/stores/Users/userApis.js`

### Backend services

- [HTTP server entry](https://github.com/haibarca03/vietglobal/blob/main/backend/index.js): `backend/index.js`
- [API route registry](https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/index.router.js): `backend/src/routers/index.router.js`
- [Product routes](https://github.com/haibarca03/vietglobal/blob/main/backend/src/routers/product.router.js): `backend/src/routers/product.router.js`
- [Product operations](https://github.com/haibarca03/vietglobal/blob/main/backend/src/controller/product.controller.js): `backend/src/controller/product.controller.js`
- [Product records](https://github.com/haibarca03/vietglobal/blob/main/backend/src/models/product.model.js): `backend/src/models/product.model.js`
- [Category records](https://github.com/haibarca03/vietglobal/blob/main/backend/src/models/category.model.js): `backend/src/models/category.model.js`
- [Content routes](https://github.com/haibarca03/vietglobal/tree/main/backend/src/routers): `backend/src/routers`
- [Site content operations](https://github.com/haibarca03/vietglobal/tree/main/backend/src/controller): `backend/src/controller`
- [Admin authorization](https://github.com/haibarca03/vietglobal/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`

### Contact messaging

- [Contact form handler](https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/mailer.controller.js): `backend/src/mailer/mailer.controller.js`
- [Email service](https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/mail.service.js): `backend/src/mailer/mail.service.js`
- [Email templates](https://github.com/haibarca03/vietglobal/blob/main/backend/src/mailer/emailtemplates.js): `backend/src/mailer/emailtemplates.js`

### Other components

- **Visitor**
- **Administrator**
- [Brevo email](https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/brevo-mail.config.js): `backend/src/config/brevo-mail.config.js`
- [MongoDB](https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/db.config.js): `backend/src/config/db.config.js`
- [Cloudinary](https://github.com/haibarca03/vietglobal/blob/main/backend/src/config/cloudinary.config.js): `backend/src/config/cloudinary.config.js`

## Connections

- Visitor → Web app routing: opens
- Web app routing → Localized pages: renders routes (evidence: `frontend/src/App.jsx`)
- Visitor → Shipping pages: browses
- Localized pages → Shipping pages: routes to (evidence: `frontend/src/router/routes.js`)
- Localized pages → Service detail: routes to (evidence: `frontend/src/router/routes.js`)
- Service detail → Service presentation: renders (evidence: `frontend/src/pages/Shipping/ServiceDetailPage.jsx`)
- Localized pages → Fulfillment: routes to (evidence: `frontend/src/router/routes.js`)
- Visitor → Catalog pages: browses
- Localized pages → Catalog pages: routes to (evidence: `frontend/src/router/routes.js`)
- Localized pages → Product detail: routes to (evidence: `frontend/src/router/routes.js`)
- Product detail → Product API client: requests product (evidence: `frontend/src/pages/ProductDetailPage/ProductDetailPage.jsx`)
- Administrator → Admin pages: manages content
- Localized pages → Admin pages: routes to (evidence: `frontend/src/router/routes.js`)
- Localized pages → Login: routes to (evidence: `frontend/src/router/routes.js`)
- Localized pages → Registration: routes to (evidence: `frontend/src/router/routes.js`)
- Login → User API client: uses (evidence: `frontend/src/pages/Login/Login.jsx`)
- HTTP server entry → API route registry: mounts (evidence: `backend/index.js`)
- API route registry → Product routes: registers (evidence: `backend/src/routers/index.router.js`)
- API route registry → Content routes: registers (evidence: `backend/src/routers/index.router.js`)
- Product routes → Product operations: dispatches (evidence: `backend/src/routers/product.router.js`)
- Product routes → Admin authorization: protects writes (evidence: `backend/src/routers/product.router.js`)
- Product operations → Product records: reads and writes (evidence: `backend/src/controller/product.controller.js`)
- Product operations → Category records: updates categories (evidence: `backend/src/controller/product.controller.js`)
- Product operations → Cloudinary: uploads images (evidence: `backend/src/controller/product.controller.js`)
- Content routes → Site content operations: dispatches (evidence: `backend/src/routers/policy.routes.js`)
- Content routes → Admin authorization: protects writes (evidence: `backend/src/routers/policy.routes.js`)
- HTTP server entry → MongoDB: connects (evidence: `backend/index.js`)
- Contact form handler → Email service: sends contact data (evidence: `backend/src/mailer/mailer.controller.js`)
- Email service → Email templates: fills templates (evidence: `backend/src/mailer/mail.service.js`)
- Email service → Brevo email: sends email (evidence: `backend/src/mailer/mail.service.js`)
