# artesia0528/booking-villa-web architecture

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

- Interactive diagram: https://gitdiagram.com/artesia0528/booking-villa-web
- Repository: https://github.com/artesia0528/booking-villa-web

## Overview

Villa Booking Web is a direct-booking site for a Bali beachfront villa. Guests browse villa and content pages, check dates and prices, submit booking or contact requests, and can proceed through payment; staff manage bookings through an authenticated admin area. The backend separates villa/content, availability/pricing, booking/request, payment, and operational concerns over PostgreSQL, with Xendit as the payment integration. The excerpts show request creation and persistence dependencies; several route-to-service and UI-to-API links are not shown, so those connections are omitted or marked unverified.

Main entry points: [`server/db/schema`](https://github.com/artesia0528/booking-villa-web/tree/master/server/db/schema) (Domain schemas), [`server/db/client.ts`](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/client.ts) (PostgreSQL data), [`server/features/requests/service.ts`](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/requests/service.ts) (Contact requests), [`server/features/bookings`](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/bookings) (Booking lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guest["Guest experience"]
  node_villa_pages["Villa browsing"]
  node_booking_ui["Booking request UI"]
  node_content["Site content"]
  node_payment_ui["Payment status UI"]
end

subgraph group_booking["Booking domain"]
  node_booking_api["Booking endpoints"]
  node_requests["Contact requests<br/>[service.ts]"]
  node_bookings["Booking lifecycle"]
  node_availability["Availability"]
  node_pricing["Price quotes"]
  node_villas["Villa catalogue<br/>[service.ts]"]
end

subgraph group_payment["Payments"]
  node_payments["Payment services<br/>[service.ts]"]
  node_webhooks["Payment webhooks<br/>[webhook.ts]"]
  node_xendit["Xendit provider<br/>[xendit.ts]"]
end

subgraph group_admin["Staff operations"]
  node_admin_ui["Admin interface"]
  node_admin_booking["Admin bookings<br/>[admin-service.ts]"]
  node_auth["Authentication"]
  node_operations["Scheduled operations<br/>[service.ts]"]
end

subgraph group_platform["Data and integrations"]
  node_db[("PostgreSQL data<br/>[client.ts]")]
  node_schema["Domain schemas"]
  node_booking_schema["Booking records<br/>[bookings.ts]"]
  node_billing_schema["Billing records<br/>[billing.ts]"]
  node_content_schema["Content records<br/>[content.ts]"]
  node_villa_schema["Villa records<br/>[villas.ts]"]
  node_rates_schema["Rate records<br/>[rates.ts]"]
  node_requests_schema["Request records<br/>[requests.ts]"]
end

node_guest(("Guest"))
node_xendit_service{{"Xendit service"}}

node_guest -.->|"browses"| node_villa_pages
node_guest -.->|"requests stay"| node_booking_ui
node_booking_ui -.->|"submits"| node_booking_api
node_booking_api -.->|"creates request"| node_requests
node_requests -->|"checks villa"| node_bookings
node_requests -->|"quotes stay"| node_pricing
node_requests -->|"stores request"| node_db
node_villas -.->|"reads catalogue"| node_db
node_availability -.->|"reads availability"| node_db
node_pricing -.->|"reads rate rules"| node_db
node_booking_api -.->|"handles booking"| node_bookings
node_bookings -->|"persists bookings"| node_db
node_guest -.->|"checks payment"| node_payment_ui
node_payment_ui -.->|"checks status"| node_payments
node_payments -.->|"requests payment"| node_xendit
node_xendit -.->|"calls provider"| node_xendit_service
node_xendit_service -.->|"sends events"| node_webhooks
node_webhooks -.->|"updates payment"| node_payments
node_admin_ui -.->|"manages bookings"| node_admin_booking
node_admin_ui -.->|"authenticates"| node_auth
node_operations -->|"expires holds"| node_bookings
node_operations -->|"reconciles payments"| node_payments
node_db -->|"uses tables"| node_schema
node_schema -->|"exports"| node_booking_schema
node_schema -->|"exports"| node_billing_schema
node_schema -->|"exports"| node_content_schema
node_schema -->|"exports"| node_villa_schema
node_schema -->|"exports"| node_rates_schema
node_schema -->|"exports"| node_requests_schema

click node_villa_pages "https://github.com/artesia0528/booking-villa-web/tree/master/app/pages/villas"
click node_booking_ui "https://github.com/artesia0528/booking-villa-web/tree/master/app/features/bookings"
click node_booking_api "https://github.com/artesia0528/booking-villa-web/tree/master/server/api"
click node_requests "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/requests/service.ts"
click node_bookings "https://github.com/artesia0528/booking-villa-web/tree/master/server/features/bookings"
click node_availability "https://github.com/artesia0528/booking-villa-web/tree/master/server/features/availability"
click node_pricing "https://github.com/artesia0528/booking-villa-web/tree/master/server/features/pricing"
click node_villas "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/villas/service.ts"
click node_content "https://github.com/artesia0528/booking-villa-web/tree/master/server/features/content"
click node_payment_ui "https://github.com/artesia0528/booking-villa-web/tree/master/app/features/payments"
click node_payments "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/payments/service.ts"
click node_webhooks "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/payments/webhook.ts"
click node_xendit "https://github.com/artesia0528/booking-villa-web/blob/master/server/providers/payment/xendit.ts"
click node_admin_ui "https://github.com/artesia0528/booking-villa-web/tree/master/app/pages/admin"
click node_admin_booking "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/bookings/admin-service.ts"
click node_auth "https://github.com/artesia0528/booking-villa-web/tree/master/server/features/auth"
click node_operations "https://github.com/artesia0528/booking-villa-web/blob/master/server/features/ops/service.ts"
click node_db "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/client.ts"
click node_schema "https://github.com/artesia0528/booking-villa-web/tree/master/server/db/schema"
click node_booking_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/bookings.ts"
click node_billing_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/billing.ts"
click node_content_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/content.ts"
click node_villa_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/villas.ts"
click node_rates_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/rates.ts"
click node_requests_schema "https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/requests.ts"

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_villa_pages,node_booking_ui,node_content,node_payment_ui toneBlue
class node_booking_api,node_requests,node_bookings,node_availability,node_pricing,node_villas toneAmber
class node_payments,node_webhooks,node_xendit toneMint
class node_admin_ui,node_admin_booking,node_auth,node_operations toneRose
class node_db,node_schema,node_booking_schema,node_billing_schema,node_content_schema,node_villa_schema,node_rates_schema,node_requests_schema,node_guest,node_xendit_service toneIndigo
```

## Components

### Guest experience

- [Villa browsing](https://github.com/artesia0528/booking-villa-web/tree/master/app/pages/villas): `app/pages/villas`
- [Booking request UI](https://github.com/artesia0528/booking-villa-web/tree/master/app/features/bookings): `app/features/bookings`
- [Site content](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/content): `server/features/content`
- [Payment status UI](https://github.com/artesia0528/booking-villa-web/tree/master/app/features/payments): `app/features/payments`

### Booking domain

- [Booking endpoints](https://github.com/artesia0528/booking-villa-web/tree/master/server/api): `server/api`
- [Contact requests](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/requests/service.ts): `server/features/requests/service.ts`
- [Booking lifecycle](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/bookings): `server/features/bookings`
- [Availability](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/availability): `server/features/availability`
- [Price quotes](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/pricing): `server/features/pricing`
- [Villa catalogue](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/villas/service.ts): `server/features/villas/service.ts`

### Payments

- [Payment services](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/payments/service.ts): `server/features/payments/service.ts`
- [Payment webhooks](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/payments/webhook.ts): `server/features/payments/webhook.ts`
- [Xendit provider](https://github.com/artesia0528/booking-villa-web/blob/master/server/providers/payment/xendit.ts): `server/providers/payment/xendit.ts`

### Staff operations

- [Admin interface](https://github.com/artesia0528/booking-villa-web/tree/master/app/pages/admin): `app/pages/admin`
- [Admin bookings](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/bookings/admin-service.ts): `server/features/bookings/admin-service.ts`
- [Authentication](https://github.com/artesia0528/booking-villa-web/tree/master/server/features/auth): `server/features/auth`
- [Scheduled operations](https://github.com/artesia0528/booking-villa-web/blob/master/server/features/ops/service.ts): `server/features/ops/service.ts`

### Data and integrations

- [PostgreSQL data](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/client.ts): `server/db/client.ts`
- [Domain schemas](https://github.com/artesia0528/booking-villa-web/tree/master/server/db/schema): `server/db/schema`
- [Booking records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/bookings.ts): `server/db/schema/bookings.ts`
- [Billing records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/billing.ts): `server/db/schema/billing.ts`
- [Content records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/content.ts): `server/db/schema/content.ts`
- [Villa records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/villas.ts): `server/db/schema/villas.ts`
- [Rate records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/rates.ts): `server/db/schema/rates.ts`
- [Request records](https://github.com/artesia0528/booking-villa-web/blob/master/server/db/schema/requests.ts): `server/db/schema/requests.ts`

### Other components

- **Guest**
- **Xendit service**

## Connections

- Guest → Villa browsing: browses
- Guest → Booking request UI: requests stay
- Booking request UI → Booking endpoints: submits
- Booking endpoints → Contact requests: creates request
- Contact requests → Booking lifecycle: checks villa (evidence: `server/features/requests/service.ts`)
- Contact requests → Price quotes: quotes stay (evidence: `server/features/requests/service.ts`)
- Contact requests → PostgreSQL data: stores request (evidence: `server/features/requests/service.ts`)
- Villa catalogue → PostgreSQL data: reads catalogue
- Availability → PostgreSQL data: reads availability
- Price quotes → PostgreSQL data: reads rate rules
- Booking endpoints → Booking lifecycle: handles booking
- Booking lifecycle → PostgreSQL data: persists bookings (evidence: `server/features/bookings/repository.ts`)
- Guest → Payment status UI: checks payment
- Payment status UI → Payment services: checks status
- Payment services → Xendit provider: requests payment
- Xendit provider → Xendit service: calls provider
- Xendit service → Payment webhooks: sends events
- Payment webhooks → Payment services: updates payment
- Admin interface → Admin bookings: manages bookings
- Admin interface → Authentication: authenticates
- Scheduled operations → Booking lifecycle: expires holds (evidence: `server/features/ops/service.ts`)
- Scheduled operations → Payment services: reconciles payments (evidence: `server/features/ops/service.ts`)
- PostgreSQL data → Domain schemas: uses tables (evidence: `server/db/client.ts`)
- Domain schemas → Booking records: exports (evidence: `server/db/schema/index.ts`)
- Domain schemas → Billing records: exports (evidence: `server/db/schema/index.ts`)
- Domain schemas → Content records: exports (evidence: `server/db/schema/index.ts`)
- Domain schemas → Villa records: exports (evidence: `server/db/schema/index.ts`)
- Domain schemas → Rate records: exports (evidence: `server/db/schema/index.ts`)
- Domain schemas → Request records: exports (evidence: `server/db/schema/index.ts`)
