# phuc1810/ota-tour-booking-system architecture

> Architecture diagram of the GitHub repository phuc1810/ota-tour-booking-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phuc1810/ota-tour-booking-system
- Repository: https://github.com/phuc1810/ota-tour-booking-system

## Overview

This is an API-first travel OTA with customer B2C booking and B2B bespoke-tour requests, plus staff operations and administrator oversight. The customer path runs from tour discovery through booking, payment confirmation, order management and review; staff manage tours, orders, calendars, promotions, content and business requests. Laravel controllers delegate to services and persist domain records; React provides the customer and management portals. The README documents concurrency-safe seat holds, SePay webhook reconciliation and scheduled cleanup/recurring-tour generation. Some subsystem links rely on README documentation because their implementation excerpts were not provided.

Main entry points: [`Backend/routes/api.php`](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/routes/api.php) (REST API routes), [`Backend/app/Models/DonDatTour.php`](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Models/DonDatTour.php) (MySQL domain records), [`Frontend/src/routes/AppRoutes.jsx`](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Frontend/src/routes/AppRoutes.jsx) (Portal routing), [`Backend/app/Services/BookingService.php`](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/BookingService.php) (Booking and orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React portals"]
  node_spa["Portal routing<br/>[AppRoutes.jsx]"]
  node_customer_ui["Customer portal"]
  node_public_ui["Tour discovery"]
  node_staff_ui["Staff and admin portal"]
  node_client_api["API clients"]
end

subgraph group_api["Laravel API"]
  node_api_routes["REST API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
end

subgraph group_commerce["Tour commerce"]
  node_booking["Booking and orders<br/>[BookingService.php]"]
  node_tour_catalog["Tour catalog<br/>[TourService.php]"]
  node_payments["Payments and refunds<br/>[PaymentService.php]"]
  node_business["B2B requests"]
  node_reviews["Customer reviews<br/>[ReviewService.php]"]
end

subgraph group_operations["Operations and governance"]
  node_staff_ops["Staff operations"]
  node_marketing["Promotions and news"]
  node_reports["Reports and dashboards"]
  node_admin["Administration"]
  node_scheduler["Scheduled order and tour jobs"]
end

subgraph group_platform["Persistence and integrations"]
  node_database[("MySQL domain records<br/>[DonDatTour.php]")]
end

node_traveler(("Traveler"))
node_staff(("Staff and admin"))
node_sepay{{"SePay"}}

node_traveler -->|"opens portal"| node_spa
node_staff -->|"opens portal"| node_spa
node_spa -->|"routes to"| node_public_ui
node_spa -->|"routes to"| node_customer_ui
node_spa -->|"routes to"| node_staff_ui
node_customer_ui -.->|"requests data"| node_client_api
node_public_ui -.->|"requests data"| node_client_api
node_staff_ui -.->|"requests data"| node_client_api
node_client_api -.->|"calls REST API"| node_api_routes
node_api_routes -->|"routes auth"| node_auth
node_api_routes -->|"routes booking"| node_booking
node_api_routes -->|"routes tours"| node_tour_catalog
node_api_routes -->|"routes payments"| node_payments
node_api_routes -->|"routes requests"| node_business
node_api_routes -->|"routes reviews"| node_reviews
node_api_routes -->|"routes operations"| node_staff_ops
node_api_routes -->|"routes content"| node_marketing
node_api_routes -->|"routes reports"| node_reports
node_api_routes -->|"routes administration"| node_admin
node_traveler -.->|"browses tours"| node_tour_catalog
node_tour_catalog -.->|"selects tour"| node_booking
node_booking -.->|"initiates payment"| node_payments
node_sepay -.->|"sends webhook"| node_payments
node_booking -.->|"writes orders"| node_database
node_payments -.->|"updates payment state"| node_database
node_business -.->|"stores requests"| node_database
node_reviews -->|"stores reviews"| node_database
node_reviews -->|"reads completed orders"| node_database
node_staff_ops -.->|"manages orders"| node_database
node_marketing -.->|"manages content"| node_database
node_reports -.->|"aggregates operations"| node_database
node_admin -.->|"manages accounts"| node_database
node_scheduler -.->|"releases expired seats"| node_database
node_scheduler -.->|"clones recurring tours"| node_tour_catalog

click node_spa "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Frontend/src/routes/AppRoutes.jsx"
click node_customer_ui "https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/customer"
click node_public_ui "https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/public"
click node_staff_ui "https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/staff"
click node_client_api "https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/api"
click node_api_routes "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/routes/api.php"
click node_auth "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Http/Controllers/Api/AuthController.php"
click node_booking "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/BookingService.php"
click node_tour_catalog "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/TourService.php"
click node_payments "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/PaymentService.php"
click node_business "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/BusinessRequestService.php"
click node_reviews "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/ReviewService.php"
click node_staff_ops "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffOrderService.php"
click node_marketing "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffPromotionService.php"
click node_reports "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffDashboardService.php"
click node_admin "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/AdminAccountService.php"
click node_scheduler "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Console/Commands/CancelUnpaidOrdersCommand.php"
click node_database "https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Models/DonDatTour.php"

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_spa,node_customer_ui,node_public_ui,node_staff_ui,node_client_api toneBlue
class node_api_routes,node_auth toneAmber
class node_booking,node_tour_catalog,node_payments,node_business,node_reviews toneMint
class node_staff_ops,node_marketing,node_reports,node_admin,node_scheduler toneRose
class node_database,node_traveler,node_staff,node_sepay toneIndigo
```

## Components

### React portals

- [Portal routing](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Frontend/src/routes/AppRoutes.jsx): `Frontend/src/routes/AppRoutes.jsx`
- [Customer portal](https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/customer): `Frontend/src/pages/customer`
- [Tour discovery](https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/public): `Frontend/src/pages/public`
- [Staff and admin portal](https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/pages/staff): `Frontend/src/pages/staff`
- [API clients](https://github.com/phuc1810/ota-tour-booking-system/tree/main/Frontend/src/api): `Frontend/src/api`

### Laravel API

- [REST API routes](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/routes/api.php): `Backend/routes/api.php`
- [Authentication](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Http/Controllers/Api/AuthController.php): `Backend/app/Http/Controllers/Api/AuthController.php`

### Tour commerce

- [Booking and orders](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/BookingService.php): `Backend/app/Services/BookingService.php`
- [Tour catalog](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/TourService.php): `Backend/app/Services/TourService.php`
- [Payments and refunds](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/PaymentService.php): `Backend/app/Services/PaymentService.php`
- [B2B requests](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/BusinessRequestService.php): `Backend/app/Services/BusinessRequestService.php`
- [Customer reviews](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/ReviewService.php): `Backend/app/Services/ReviewService.php`

### Operations and governance

- [Staff operations](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffOrderService.php): `Backend/app/Services/StaffOrderService.php`
- [Promotions and news](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffPromotionService.php): `Backend/app/Services/StaffPromotionService.php`
- [Reports and dashboards](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/StaffDashboardService.php): `Backend/app/Services/StaffDashboardService.php`
- [Administration](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Services/AdminAccountService.php): `Backend/app/Services/AdminAccountService.php`
- [Scheduled order and tour jobs](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Console/Commands/CancelUnpaidOrdersCommand.php): `Backend/app/Console/Commands/CancelUnpaidOrdersCommand.php`

### Persistence and integrations

- [MySQL domain records](https://github.com/phuc1810/ota-tour-booking-system/blob/main/Backend/app/Models/DonDatTour.php): `Backend/app/Models/DonDatTour.php`

### Other components

- **Traveler**
- **Staff and admin**
- **SePay**

## Connections

- Traveler → Portal routing: opens portal (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Staff and admin → Portal routing: opens portal (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Portal routing → Tour discovery: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Portal routing → Customer portal: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Portal routing → Staff and admin portal: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Customer portal → API clients: requests data (evidence: `Frontend/src/pages/customer/ReviewBusinessRequestPage.jsx`)
- Tour discovery → API clients: requests data
- Staff and admin portal → API clients: requests data
- API clients → REST API routes: calls REST API
- REST API routes → Authentication: routes auth (evidence: `Backend/routes/api.php`)
- REST API routes → Booking and orders: routes booking (evidence: `Backend/routes/api.php`)
- REST API routes → Tour catalog: routes tours (evidence: `Backend/routes/api.php`)
- REST API routes → Payments and refunds: routes payments (evidence: `Backend/routes/api.php`)
- REST API routes → B2B requests: routes requests (evidence: `Backend/routes/api.php`)
- REST API routes → Customer reviews: routes reviews (evidence: `Backend/routes/api.php`)
- REST API routes → Staff operations: routes operations (evidence: `Backend/routes/api.php`)
- REST API routes → Promotions and news: routes content (evidence: `Backend/routes/api.php`)
- REST API routes → Reports and dashboards: routes reports (evidence: `Backend/routes/api.php`)
- REST API routes → Administration: routes administration (evidence: `Backend/routes/api.php`)
- Traveler → Tour catalog: browses tours
- Tour catalog → Booking and orders: selects tour
- Booking and orders → Payments and refunds: initiates payment
- SePay → Payments and refunds: sends webhook
- Booking and orders → MySQL domain records: writes orders
- Payments and refunds → MySQL domain records: updates payment state
- B2B requests → MySQL domain records: stores requests
- Customer reviews → MySQL domain records: stores reviews (evidence: `Backend/app/Services/ReviewService.php`)
- Customer reviews → MySQL domain records: reads completed orders (evidence: `Backend/app/Services/ReviewService.php`)
- Staff operations → MySQL domain records: manages orders
- Promotions and news → MySQL domain records: manages content
- Reports and dashboards → MySQL domain records: aggregates operations
- Administration → MySQL domain records: manages accounts
- Scheduled order and tour jobs → MySQL domain records: releases expired seats
- Scheduled order and tour jobs → Tour catalog: clones recurring tours
