# ltcuong1997-creator/khachsancliffhouse architecture

> Architecture diagram of the GitHub repository ltcuong1997-creator/khachsancliffhouse, 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/ltcuong1997-creator/khachsancliffhouse
- Repository: https://github.com/ltcuong1997-creator/khachsancliffhouse

## Overview

Cliff House is a browser-based hotel administration app for reviewing monthly finances and managing cashbook, attendance, payroll, staff, and settings. Its main workflow is a user opening a reporting or operational page, reviewing or editing hotel data, and using payroll rules to calculate labor costs and profit. A companion robot logs into KiotViet, retrieves cashbook entries, reconciles them, and writes them to Firestore. The app source is a single unsampled HTML file, so page components and their internal data flow are based on README documentation; robot relationships are supported by the excerpts.

Main entry points: [`public/index.html`](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html) (Admin app), [`robot/soquy/sync.js`](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/sync.js) (Cashbook sync robot), [`robot/soquy/kv.js`](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/kv.js) (KiotViet API client), [`robot/soquy/survey.js`](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/survey.js) (API survey)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reports["Financial reports"]
  node_app["Admin app<br/>[index.html]"]
  node_monthly["Monthly report<br/>[index.html]"]
  node_expenses["Expense details<br/>[index.html]"]
  node_annual["Annual P&amp;L<br/>[index.html]"]
end

subgraph group_operations["Hotel operations"]
  node_cashbook["Cashbook view<br/>[index.html]"]
  node_attendance["Attendance<br/>[index.html]"]
  node_payroll["Payroll<br/>[index.html]"]
  node_staff["Staff records<br/>[index.html]"]
  node_settings["Configuration<br/>[index.html]"]
  node_profit["Profit calculation<br/>[index.html]"]
  node_demo[("Browser demo data<br/>[index.html]")]
end

subgraph group_sync["Cashbook sync"]
  node_sync["Cashbook sync robot<br/>[sync.js]"]
  node_kv["KiotViet API client<br/>[kv.js]"]
  node_survey["API survey<br/>[survey.js]"]
end

node_user(("Hotel staff"))
node_actions(("GitHub Actions"))
node_kiotviet["KiotViet Hotel"]
node_firestore[("Firestore")]

node_user -->|"opens"| node_app
node_app -->|"offers page"| node_monthly
node_app -->|"offers page"| node_expenses
node_app -->|"offers page"| node_annual
node_app -->|"offers page"| node_cashbook
node_app -->|"offers page"| node_attendance
node_app -->|"offers page"| node_payroll
node_app -->|"offers page"| node_staff
node_app -->|"offers page"| node_settings
node_monthly -->|"uses totals"| node_profit
node_annual -->|"uses totals"| node_profit
node_attendance -->|"supplies hours"| node_payroll
node_payroll -->|"supplies labor cost"| node_profit
node_app -->|"uses in demo"| node_demo
node_actions -->|"runs"| node_sync
node_sync -->|"calls login and fetch"| node_kv
node_kv -->|"reads cashbook"| node_kiotviet
node_sync -->|"writes cash records"| node_firestore
node_survey -->|"probes API"| node_kiotviet

click node_app "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_monthly "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_expenses "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_annual "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_cashbook "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_attendance "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_payroll "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_staff "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_settings "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_profit "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_demo "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html"
click node_sync "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/sync.js"
click node_kv "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/kv.js"
click node_survey "https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/survey.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_monthly,node_expenses,node_annual toneBlue
class node_cashbook,node_attendance,node_payroll,node_staff,node_settings,node_profit,node_demo,node_firestore toneAmber
class node_sync,node_kv,node_survey toneMint
class node_user,node_actions,node_kiotviet toneIndigo
```

## Components

### Financial reports

- [Admin app](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Monthly report](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Expense details](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Annual P&L](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`

### Hotel operations

- [Cashbook view](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Attendance](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Payroll](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Staff records](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Configuration](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Profit calculation](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`
- [Browser demo data](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/public/index.html): `public/index.html`

### Cashbook sync

- [Cashbook sync robot](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/sync.js): `robot/soquy/sync.js`
- [KiotViet API client](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/kv.js): `robot/soquy/kv.js`
- [API survey](https://github.com/ltcuong1997-creator/khachsancliffhouse/blob/main/robot/soquy/survey.js): `robot/soquy/survey.js`

### Other components

- **Hotel staff**
- **GitHub Actions**
- **KiotViet Hotel**
- **Firestore**

## Connections

- Hotel staff → Admin app: opens (evidence: `README.md`)
- Admin app → Monthly report: offers page (evidence: `README.md`)
- Admin app → Expense details: offers page (evidence: `README.md`)
- Admin app → Annual P&L: offers page (evidence: `README.md`)
- Admin app → Cashbook view: offers page (evidence: `README.md`)
- Admin app → Attendance: offers page (evidence: `README.md`)
- Admin app → Payroll: offers page (evidence: `README.md`)
- Admin app → Staff records: offers page (evidence: `README.md`)
- Admin app → Configuration: offers page (evidence: `README.md`)
- Monthly report → Profit calculation: uses totals (evidence: `README.md`)
- Annual P&L → Profit calculation: uses totals (evidence: `README.md`)
- Attendance → Payroll: supplies hours (evidence: `README.md`)
- Payroll → Profit calculation: supplies labor cost (evidence: `README.md`)
- Admin app → Browser demo data: uses in demo (evidence: `README.md`)
- GitHub Actions → Cashbook sync robot: runs (evidence: `robot/soquy/sync.js`)
- Cashbook sync robot → KiotViet API client: calls login and fetch (evidence: `robot/soquy/sync.js`)
- KiotViet API client → KiotViet Hotel: reads cashbook (evidence: `robot/soquy/kv.js`)
- Cashbook sync robot → Firestore: writes cash records (evidence: `robot/soquy/sync.js`)
- API survey → KiotViet Hotel: probes API (evidence: `robot/soquy/survey.js`)
