# dinhtron027/wepsalonhair architecture

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

- Interactive diagram: https://gitdiagram.com/dinhtron027/wepsalonhair
- Repository: https://github.com/dinhtron027/wepsalonhair

## Overview

Salon Dương Chi is a salon booking and management system with a customer-facing website and an admin dashboard. Customers browse services and products, authenticate, and book appointments or place orders; staff and admins manage bookings, customers, inventory, and salon offerings. The backend exposes API routes and delegates domain operations to services backed by MongoDB, with realtime updates and notification integrations. The graph reflects documented capabilities and sampled calls; unsampled routes and integrations are shown only where README evidence supports them.

Main entry points: [`backend/services/bookingService.js`](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/bookingService.js) (Booking and availability), [`frontend/src/App.tsx`](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/App.tsx) (Website and dashboard), [`backend/controllers/adminController.js`](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/adminController.js) (Admin handlers), [`backend/app.js`](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/app.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer website"]
  node_webapp["Website and dashboard<br/>[App.tsx]"]
  node_authui["Login workflow"]
  node_authclient["Auth client service<br/>[AuthService.ts]"]
  node_bookingui["Booking pages<br/>[BookingPage.tsx]"]
  node_adminui["Admin operations<br/>[Services.tsx]"]
end

subgraph group_api["Backend API"]
  node_apiapp["Express API<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_bookingroutes["Booking routes<br/>[bookingRoutes.js]"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_authcontroller["Auth handlers<br/>[authController.js]"]
  node_bookingcontroller["Booking handlers"]
  node_admincontroller["Admin handlers<br/>[adminController.js]"]
end

subgraph group_domain["Salon operations"]
  node_authservice["Authentication<br/>[authService.js]"]
  node_bookingservice["Booking and availability<br/>[bookingService.js]"]
  node_customerservice["Customer profiles and insights<br/>[customerService.js]"]
  node_adminservice["Admin operations<br/>[adminService.js]"]
end

subgraph group_state["Data and realtime"]
  node_servicemodel["Salon service catalog<br/>[Service.js]"]
  node_bookingmodel["Booking records<br/>[Booking.js]"]
  node_customermodel["Customer records<br/>[Customer.js]"]
  node_database[("MongoDB<br/>[db.js]")]
  node_socket["Realtime events<br/>[io.js]"]
end

subgraph group_integrations["External services"]
  node_notification["Booking notifications"]
  node_payment["Payment providers<br/>[paymentService.js]"]
  node_email["Email and Zalo<br/>[emailService.js]"]
end

node_visitor(("Customer or staff"))

node_visitor -->|"uses"| node_webapp
node_webapp -.->|"requests API"| node_apiapp
node_webapp -->|"routes to"| node_authui
node_webapp -->|"routes to"| node_bookingui
node_webapp -->|"routes to"| node_adminui
node_authui -->|"uses auth state"| node_authclient
node_apiapp -->|"mounts"| node_authroutes
node_apiapp -->|"mounts"| node_bookingroutes
node_apiapp -->|"mounts"| node_adminroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_bookingroutes -->|"dispatches"| node_bookingcontroller
node_adminroutes -->|"dispatches"| node_admincontroller
node_authcontroller -->|"calls"| node_authservice
node_bookingcontroller -->|"calls"| node_bookingservice
node_admincontroller -->|"calls"| node_adminservice
node_admincontroller -->|"calls"| node_bookingservice
node_admincontroller -->|"calls"| node_customerservice
node_admincontroller -->|"emits updates"| node_socket
node_bookingservice -->|"reads"| node_servicemodel
node_bookingservice -->|"checks and saves"| node_bookingmodel
node_bookingservice -->|"refreshes stats"| node_customerservice
node_bookingservice -->|"notifies"| node_notification
node_bookingservice -->|"emits events"| node_socket
node_customerservice -->|"reads and updates"| node_customermodel
node_authservice -.->|"verifies social identity"| node_email
node_authservice -.->|"ensures profile"| node_customermodel
node_bookingmodel -.->|"persists"| node_database
node_visitor -.->|"pays for orders"| node_payment
node_visitor -.->|"receives messages"| node_email

click node_webapp "https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/modules/auth/control/hooks/useAuthController.ts"
click node_authclient "https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/modules/auth/control/services/AuthService.ts"
click node_bookingui "https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/pages/BookingPage.tsx"
click node_adminui "https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/pages/admin/Services.tsx"
click node_apiapp "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/app.js"
click node_authroutes "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/authRoutes.js"
click node_bookingroutes "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/bookingRoutes.js"
click node_adminroutes "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/adminRoutes.js"
click node_authcontroller "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/authController.js"
click node_bookingcontroller "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/bookingController.js"
click node_admincontroller "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/adminController.js"
click node_authservice "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/authService.js"
click node_bookingservice "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/bookingService.js"
click node_customerservice "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/customerService.js"
click node_adminservice "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/adminService.js"
click node_servicemodel "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Service.js"
click node_bookingmodel "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Booking.js"
click node_customermodel "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Customer.js"
click node_database "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/config/db.js"
click node_socket "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/socket/io.js"
click node_notification "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/notificationService.js"
click node_payment "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/paymentService.js"
click node_email "https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/emailService.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_webapp,node_authui,node_authclient,node_bookingui,node_adminui toneBlue
class node_apiapp,node_authroutes,node_bookingroutes,node_adminroutes,node_authcontroller,node_bookingcontroller,node_admincontroller toneAmber
class node_authservice,node_bookingservice,node_customerservice,node_adminservice toneMint
class node_servicemodel,node_bookingmodel,node_customermodel,node_database,node_socket toneRose
class node_notification,node_payment,node_email,node_visitor toneIndigo
```

## Components

### Customer website

- [Website and dashboard](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login workflow](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/modules/auth/control/hooks/useAuthController.ts): `frontend/src/modules/auth/control/hooks/useAuthController.ts`
- [Auth client service](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/modules/auth/control/services/AuthService.ts): `frontend/src/modules/auth/control/services/AuthService.ts`
- [Booking pages](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/pages/BookingPage.tsx): `frontend/src/pages/BookingPage.tsx`
- [Admin operations](https://github.com/dinhtron027/wepsalonhair/blob/main/frontend/src/pages/admin/Services.tsx): `frontend/src/pages/admin/Services.tsx`

### Backend API

- [Express API](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/app.js): `backend/app.js`
- [Auth routes](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Booking routes](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/bookingRoutes.js): `backend/routes/bookingRoutes.js`
- [Admin routes](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/routes/adminRoutes.js): `backend/routes/adminRoutes.js`
- [Auth handlers](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Booking handlers](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/bookingController.js): `backend/controllers/bookingController.js`
- [Admin handlers](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`

### Salon operations

- [Authentication](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/authService.js): `backend/services/authService.js`
- [Booking and availability](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/bookingService.js): `backend/services/bookingService.js`
- [Customer profiles and insights](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/customerService.js): `backend/services/customerService.js`
- [Admin operations](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/adminService.js): `backend/services/adminService.js`

### Data and realtime

- [Salon service catalog](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Service.js): `backend/models/Service.js`
- [Booking records](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Booking.js): `backend/models/Booking.js`
- [Customer records](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/models/Customer.js): `backend/models/Customer.js`
- [MongoDB](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/config/db.js): `backend/config/db.js`
- [Realtime events](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/socket/io.js): `backend/socket/io.js`

### External services

- [Booking notifications](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/notificationService.js): `backend/services/notificationService.js`
- [Payment providers](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/paymentService.js): `backend/services/paymentService.js`
- [Email and Zalo](https://github.com/dinhtron027/wepsalonhair/blob/main/backend/services/emailService.js): `backend/services/emailService.js`

### Other components

- **Customer or staff**

## Connections

- Customer or staff → Website and dashboard: uses
- Website and dashboard → Express API: requests API
- Website and dashboard → Login workflow: routes to (evidence: `frontend/src/App.tsx`)
- Website and dashboard → Booking pages: routes to (evidence: `frontend/src/App.tsx`)
- Website and dashboard → Admin operations: routes to (evidence: `frontend/src/App.tsx`)
- Login workflow → Auth client service: uses auth state (evidence: `frontend/src/modules/auth/control/hooks/useAuthController.ts`)
- Express API → Auth routes: mounts (evidence: `backend/app.js`)
- Express API → Booking routes: mounts (evidence: `backend/app.js`)
- Express API → Admin routes: mounts (evidence: `backend/app.js`)
- Auth routes → Auth handlers: dispatches (evidence: `backend/routes/authRoutes.js`)
- Booking routes → Booking handlers: dispatches (evidence: `backend/routes/bookingRoutes.js`)
- Admin routes → Admin handlers: dispatches (evidence: `backend/routes/adminRoutes.js`)
- Auth handlers → Authentication: calls (evidence: `backend/controllers/authController.js`)
- Booking handlers → Booking and availability: calls (evidence: `backend/controllers/bookingController.js`)
- Admin handlers → Admin operations: calls (evidence: `backend/controllers/adminController.js`)
- Admin handlers → Booking and availability: calls (evidence: `backend/controllers/adminController.js`)
- Admin handlers → Customer profiles and insights: calls (evidence: `backend/controllers/adminController.js`)
- Admin handlers → Realtime events: emits updates (evidence: `backend/controllers/adminController.js`)
- Booking and availability → Salon service catalog: reads (evidence: `backend/services/bookingService.js`)
- Booking and availability → Booking records: checks and saves (evidence: `backend/services/bookingService.js`)
- Booking and availability → Customer profiles and insights: refreshes stats (evidence: `backend/services/bookingService.js`)
- Booking and availability → Booking notifications: notifies (evidence: `backend/services/bookingService.js`)
- Booking and availability → Realtime events: emits events (evidence: `backend/services/bookingService.js`)
- Customer profiles and insights → Customer records: reads and updates (evidence: `backend/services/customerService.js`)
- Authentication → Email and Zalo: verifies social identity
- Authentication → Customer records: ensures profile
- Booking records → MongoDB: persists
- Customer or staff → Payment providers: pays for orders
- Customer or staff → Email and Zalo: receives messages
