# tonbunheng/tourism-backend-api architecture

> Architecture diagram of the GitHub repository tonbunheng/tourism-backend-api, 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/tonbunheng/tourism-backend-api
- Repository: https://github.com/tonbunheng/tourism-backend-api

## Overview

AngkorVerses is a Laravel REST API serving an admin portal and tourist web/mobile clients. Tourists authenticate, discover Cambodian destinations and events, and use reviews, favorites, trip planning, galleries, achievements, and an AI assistant; business owners manage listings, while staff administer content and moderation. The graph emphasizes documented API capabilities and sampled review, business, and achievement behavior. Several feature controllers were not sampled, so their internal calls are not inferred; route and feature links rely on the route index or README.

Main entry points: [`routes/api.php`](https://github.com/tonbunheng/tourism-backend-api/blob/main/routes/api.php) (REST routes), [`app/Http/Controllers/Api/Travel/TravelReviewController.php`](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelReviewController.php) (Review workflows), [`app/Models/Place.php`](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Place.php) (Places), [`app/Http/Controllers/Api/Admin/AdminBusinessController.php`](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Admin/AdminBusinessController.php) (Business moderation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api_routes["REST routes<br/>[api.php]"]
  node_travel_auth["Travel authentication"]
  node_api_auth["Admin authentication<br/>[AuthController.php]"]
  node_response_format["API responses<br/>[ApiResponse.php]"]
end

subgraph group_discovery["Tourism discovery"]
  node_places["Place discovery"]
  node_provinces["Province browsing"]
  node_events["Events and festivals"]
  node_places_data[("Places<br/>[Place.php]")]
  node_provinces_data[("Provinces<br/>[Province.php]")]
  node_categories_data[("Categories<br/>[Category.php]")]
  node_events_data[("Events<br/>[Event.php]")]
end

subgraph group_engagement["Tourist engagement"]
  node_reviews["Review workflows"]
  node_review_data[("Reviews<br/>[Review.php]")]
  node_review_resource["Review representation<br/>[ReviewResource.php]"]
  node_favorites["Favorites"]
  node_trips["Trip planning"]
  node_gallery["Media gallery"]
  node_achievements["Achievements"]
  node_ai_assistant["AI assistant<br/>[AiChatService.php]"]
  node_review_replies[("Review replies<br/>[ReviewReply.php]")]
end

subgraph group_business["Business operations"]
  node_business_owner["Owner management"]
  node_business_admin["Business moderation"]
  node_business_data[("Business profiles<br/>[Business.php]")]
end

subgraph group_admin["Administration"]
  node_users[("User accounts<br/>[User.php]")]
  node_notifications[("Notifications<br/>[Notification.php]")]
  node_audit["Audit logging<br/>[AuditLogger.php]"]
end

node_tourist(("Tourist clients"))
node_admin_client(("Admin portal"))

node_tourist -->|"calls travel API"| node_api_routes
node_admin_client -->|"calls admin API"| node_api_routes
node_api_routes -->|"routes travel auth"| node_travel_auth
node_api_routes -->|"routes admin auth"| node_api_auth
node_api_routes -->|"routes places"| node_places
node_api_routes -->|"routes provinces"| node_provinces
node_api_routes -->|"routes events"| node_events
node_api_routes -->|"routes reviews"| node_reviews
node_api_routes -->|"routes favorites"| node_favorites
node_api_routes -->|"routes trips"| node_trips
node_api_routes -->|"routes gallery"| node_gallery
node_api_routes -->|"routes owner tools"| node_business_owner
node_api_routes -->|"routes admin tools"| node_business_admin
node_places -->|"queries places"| node_places_data
node_provinces -->|"browses provinces"| node_provinces_data
node_events -->|"browses events"| node_events_data
node_reviews -->|"creates and updates"| node_review_data
node_reviews -->|"returns resource"| node_review_resource
node_reviews -->|"updates rating"| node_places_data
node_reviews -->|"checks awards"| node_achievements
node_reviews -->|"creates notification"| node_notifications
node_review_data -->|"has replies"| node_review_replies
node_business_owner -->|"manages profiles"| node_business_data
node_business_admin -->|"moderates profiles"| node_business_data
node_business_admin -->|"records changes"| node_audit
node_achievements -->|"counts reviews"| node_review_data
node_places_data -->|"belongs to"| node_categories_data
node_places_data -->|"belongs to"| node_provinces_data
node_business_data -->|"belongs to owner"| node_users
node_api_routes -->|"offers AI assistant"| node_ai_assistant
node_api_routes -->|"offers achievements"| node_achievements
node_api_routes -.->|"uses response format"| node_response_format

click node_api_routes "https://github.com/tonbunheng/tourism-backend-api/blob/main/routes/api.php"
click node_travel_auth "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelAuthController.php"
click node_api_auth "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/AuthController.php"
click node_response_format "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Traits/ApiResponse.php"
click node_places "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelPlaceController.php"
click node_provinces "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelProvinceController.php"
click node_events "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelEventController.php"
click node_places_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Place.php"
click node_provinces_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Province.php"
click node_categories_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Category.php"
click node_events_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Event.php"
click node_reviews "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelReviewController.php"
click node_review_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Review.php"
click node_review_resource "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Resources/ReviewResource.php"
click node_favorites "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelFavoriteController.php"
click node_trips "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelTripController.php"
click node_gallery "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelGalleryController.php"
click node_achievements "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AchievementManager.php"
click node_ai_assistant "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AiChatService.php"
click node_business_owner "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Business/BusinessOwnerController.php"
click node_business_admin "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Admin/AdminBusinessController.php"
click node_business_data "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Business.php"
click node_users "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/User.php"
click node_notifications "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Notification.php"
click node_audit "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AuditLogger.php"
click node_review_replies "https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/ReviewReply.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_api_routes,node_travel_auth,node_api_auth,node_response_format,node_tourist toneBlue
class node_places,node_provinces,node_events,node_places_data,node_provinces_data,node_categories_data,node_events_data toneAmber
class node_reviews,node_review_data,node_review_resource,node_favorites,node_trips,node_gallery,node_achievements,node_ai_assistant,node_review_replies toneMint
class node_business_owner,node_business_admin,node_business_data toneRose
class node_users,node_notifications,node_audit,node_admin_client toneIndigo
```

## Components

### API entry

- [REST routes](https://github.com/tonbunheng/tourism-backend-api/blob/main/routes/api.php): `routes/api.php`
- [Travel authentication](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelAuthController.php): `app/Http/Controllers/Api/Travel/TravelAuthController.php`
- [Admin authentication](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/AuthController.php): `app/Http/Controllers/Api/AuthController.php`
- [API responses](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Traits/ApiResponse.php): `app/Traits/ApiResponse.php`

### Tourism discovery

- [Place discovery](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelPlaceController.php): `app/Http/Controllers/Api/Travel/TravelPlaceController.php`
- [Province browsing](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelProvinceController.php): `app/Http/Controllers/Api/Travel/TravelProvinceController.php`
- [Events and festivals](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelEventController.php): `app/Http/Controllers/Api/Travel/TravelEventController.php`
- [Places](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Place.php): `app/Models/Place.php`
- [Provinces](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Province.php): `app/Models/Province.php`
- [Categories](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Events](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Event.php): `app/Models/Event.php`

### Tourist engagement

- [Review workflows](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelReviewController.php): `app/Http/Controllers/Api/Travel/TravelReviewController.php`
- [Reviews](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Review.php): `app/Models/Review.php`
- [Review representation](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Resources/ReviewResource.php): `app/Http/Resources/ReviewResource.php`
- [Favorites](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelFavoriteController.php): `app/Http/Controllers/Api/Travel/TravelFavoriteController.php`
- [Trip planning](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelTripController.php): `app/Http/Controllers/Api/Travel/TravelTripController.php`
- [Media gallery](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Travel/TravelGalleryController.php): `app/Http/Controllers/Api/Travel/TravelGalleryController.php`
- [Achievements](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AchievementManager.php): `app/Services/AchievementManager.php`
- [AI assistant](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AiChatService.php): `app/Services/AiChatService.php`
- [Review replies](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/ReviewReply.php): `app/Models/ReviewReply.php`

### Business operations

- [Owner management](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Business/BusinessOwnerController.php): `app/Http/Controllers/Api/Business/BusinessOwnerController.php`
- [Business moderation](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Http/Controllers/Api/Admin/AdminBusinessController.php): `app/Http/Controllers/Api/Admin/AdminBusinessController.php`
- [Business profiles](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Business.php): `app/Models/Business.php`

### Administration

- [User accounts](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/User.php): `app/Models/User.php`
- [Notifications](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Models/Notification.php): `app/Models/Notification.php`
- [Audit logging](https://github.com/tonbunheng/tourism-backend-api/blob/main/app/Services/AuditLogger.php): `app/Services/AuditLogger.php`

### Other components

- **Tourist clients**
- **Admin portal**

## Connections

- Tourist clients → REST routes: calls travel API
- Admin portal → REST routes: calls admin API
- REST routes → Travel authentication: routes travel auth (evidence: `routes/api.php`)
- REST routes → Admin authentication: routes admin auth (evidence: `routes/api.php`)
- REST routes → Place discovery: routes places (evidence: `routes/api.php`)
- REST routes → Province browsing: routes provinces (evidence: `routes/api.php`)
- REST routes → Events and festivals: routes events (evidence: `routes/api.php`)
- REST routes → Review workflows: routes reviews (evidence: `routes/api.php`)
- REST routes → Favorites: routes favorites (evidence: `routes/api.php`)
- REST routes → Trip planning: routes trips (evidence: `routes/api.php`)
- REST routes → Media gallery: routes gallery (evidence: `routes/api.php`)
- REST routes → Owner management: routes owner tools (evidence: `routes/api.php`)
- REST routes → Business moderation: routes admin tools (evidence: `routes/api.php`)
- Place discovery → Places: queries places
- Province browsing → Provinces: browses provinces
- Events and festivals → Events: browses events
- Review workflows → Reviews: creates and updates (evidence: `app/Http/Controllers/Api/Travel/TravelReviewController.php`)
- Review workflows → Review representation: returns resource (evidence: `app/Http/Controllers/Api/Travel/TravelReviewController.php`)
- Review workflows → Places: updates rating (evidence: `app/Http/Controllers/Api/Travel/TravelReviewController.php`)
- Review workflows → Achievements: checks awards (evidence: `app/Http/Controllers/Api/Travel/TravelReviewController.php`)
- Review workflows → Notifications: creates notification (evidence: `app/Http/Controllers/Api/Travel/TravelReviewController.php`)
- Reviews → Review replies: has replies (evidence: `app/Models/Review.php`)
- Owner management → Business profiles: manages profiles (evidence: `app/Http/Controllers/Api/Business/BusinessOwnerController.php`)
- Business moderation → Business profiles: moderates profiles (evidence: `app/Http/Controllers/Api/Admin/AdminBusinessController.php`)
- Business moderation → Audit logging: records changes (evidence: `app/Http/Controllers/Api/Admin/AdminBusinessController.php`)
- Achievements → Reviews: counts reviews (evidence: `app/Services/AchievementManager.php`)
- Places → Categories: belongs to (evidence: `app/Models/Place.php`)
- Places → Provinces: belongs to (evidence: `app/Models/Place.php`)
- Business profiles → User accounts: belongs to owner (evidence: `app/Models/Business.php`)
- REST routes → AI assistant: offers AI assistant
- REST routes → Achievements: offers achievements
- REST routes → API responses: uses response format
