# nxpze/sea_webapp architecture

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

- Interactive diagram: https://gitdiagram.com/nxpze/sea_webapp
- Repository: https://github.com/nxpze/sea_webapp

## Overview

ทริปทะเล 2027 เป็นเว็บแอปวางแผนทริปกลุ่มและจัดการการเงินสมาชิก เส้นทางหลักคือสมาชิกใช้หน้าเว็บเรียก API เพื่อดูแผน/สถานที่/อากาศ หรือทำรายการการเงิน; API ตรวจสิทธิ์และอ่านเขียนฐานข้อมูล รวมถึงจัดการสลิป ระบบการเงินและการแจ้งเตือนอยู่ใน API หลัก ไม่ได้แยกเป็นโมดูลตามไฟล์ที่ให้มา หลายรายละเอียดของหน้าเว็บและเส้นทาง API ไม่ปรากฏใน excerpts จึงแสดงเฉพาะความสัมพันธ์ที่มีหลักฐานชัดเจน

Main entry points: [`netlify/functions/api.js`](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js) (API หลัก), [`netlify/functions/db.js`](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/db.js) (ฐานข้อมูล client), [`netlify/functions/itinerary.js`](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/itinerary.js) (แผนและสถานที่), [`src/js/app.js`](https://github.com/nxpze/sea_webapp/blob/main/src/js/app.js) (หน้าเว็บและแดชบอร์ด)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["เว็บแอป"]
  node_webapp["หน้าเว็บและแดชบอร์ด<br/>[app.js]"]
end

subgraph group_api["API และโดเมน"]
  node_api_router["API หลัก<br/>[api.js]"]
  node_auth["ยืนยันตัวตน<br/>[auth.js]"]
  node_finance["การเงินกลุ่ม<br/>[api.js]"]
  node_records["Audit และแจ้งเตือน<br/>[api.js]"]
  node_itinerary["แผนและสถานที่<br/>[itinerary.js]"]
  node_weather["พยากรณ์อากาศ<br/>[weather.js]"]
  node_db_client["ฐานข้อมูล client<br/>[db.js]"]
end

subgraph group_data["ข้อมูลทริป"]
  node_plan_data["ข้อมูลแผนทริป<br/>[plan.json]"]
  node_places_data["ข้อมูลสถานที่<br/>[place.json]"]
end

subgraph group_services["บริการภายนอก"]
  node_yugabyte[("YugabyteDB")]
  node_supabase[("Supabase Storage")]
  node_open_meteo["Open-Meteo"]
end

node_member(("สมาชิกทริป"))

node_member -->|"uses"| node_webapp
node_webapp -->|"requests"| node_api_router
node_api_router -->|"delegates to"| node_auth
node_auth -->|"queries"| node_db_client
node_api_router -->|"queries"| node_db_client
node_api_router -->|"delegates to"| node_itinerary
node_api_router -->|"fetches forecast"| node_weather
node_itinerary -->|"reads"| node_plan_data
node_itinerary -->|"reads"| node_places_data
node_weather -->|"fetches forecast"| node_open_meteo
node_db_client -->|"queries"| node_yugabyte
node_api_router -->|"uploads slips"| node_supabase
node_api_router -->|"signs slip URLs"| node_supabase
node_api_router -->|"handles routes"| node_finance
node_api_router -->|"writes records"| node_records
node_finance -->|"stores transactions"| node_db_client
node_records -->|"stores logs"| node_db_client

click node_webapp "https://github.com/nxpze/sea_webapp/blob/main/src/js/app.js"
click node_api_router "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js"
click node_auth "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/auth.js"
click node_finance "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js"
click node_records "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js"
click node_itinerary "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/itinerary.js"
click node_weather "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/weather.js"
click node_db_client "https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/db.js"
click node_plan_data "https://github.com/nxpze/sea_webapp/blob/main/src/data/place_data/plan.json"
click node_places_data "https://github.com/nxpze/sea_webapp/blob/main/src/data/place_data/place.json"

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 toneBlue
class node_api_router,node_auth,node_finance,node_records,node_itinerary,node_weather,node_db_client toneAmber
class node_plan_data,node_places_data toneMint
class node_yugabyte,node_supabase,node_open_meteo toneRose
class node_member toneIndigo
```

## Components

### เว็บแอป

- [หน้าเว็บและแดชบอร์ด](https://github.com/nxpze/sea_webapp/blob/main/src/js/app.js): `src/js/app.js`

### API และโดเมน

- [API หลัก](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js): `netlify/functions/api.js`
- [ยืนยันตัวตน](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/auth.js): `netlify/functions/auth.js`
- [การเงินกลุ่ม](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js): `netlify/functions/api.js`
- [Audit และแจ้งเตือน](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/api.js): `netlify/functions/api.js`
- [แผนและสถานที่](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/itinerary.js): `netlify/functions/itinerary.js`
- [พยากรณ์อากาศ](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/weather.js): `netlify/functions/weather.js`
- [ฐานข้อมูล client](https://github.com/nxpze/sea_webapp/blob/main/netlify/functions/db.js): `netlify/functions/db.js`

### ข้อมูลทริป

- [ข้อมูลแผนทริป](https://github.com/nxpze/sea_webapp/blob/main/src/data/place_data/plan.json): `src/data/place_data/plan.json`
- [ข้อมูลสถานที่](https://github.com/nxpze/sea_webapp/blob/main/src/data/place_data/place.json): `src/data/place_data/place.json`

### บริการภายนอก

- **YugabyteDB**
- **Supabase Storage**
- **Open-Meteo**

### Other components

- **สมาชิกทริป**

## Connections

- สมาชิกทริป → หน้าเว็บและแดชบอร์ด: uses (evidence: `README.md`)
- หน้าเว็บและแดชบอร์ด → API หลัก: requests (evidence: `src/js/app.js`)
- API หลัก → ยืนยันตัวตน: delegates to (evidence: `netlify/functions/api.js`)
- ยืนยันตัวตน → ฐานข้อมูล client: queries (evidence: `netlify/functions/auth.js`)
- API หลัก → ฐานข้อมูล client: queries (evidence: `netlify/functions/api.js`)
- API หลัก → แผนและสถานที่: delegates to (evidence: `netlify/functions/api.js`)
- API หลัก → พยากรณ์อากาศ: fetches forecast (evidence: `netlify/functions/api.js`)
- แผนและสถานที่ → ข้อมูลแผนทริป: reads (evidence: `netlify/functions/itinerary.js`)
- แผนและสถานที่ → ข้อมูลสถานที่: reads (evidence: `netlify/functions/itinerary.js`)
- พยากรณ์อากาศ → Open-Meteo: fetches forecast (evidence: `netlify/functions/weather.js`)
- ฐานข้อมูล client → YugabyteDB: queries (evidence: `README.md`)
- API หลัก → Supabase Storage: uploads slips (evidence: `netlify/functions/api.js`)
- API หลัก → Supabase Storage: signs slip URLs (evidence: `netlify/functions/api.js`)
- API หลัก → การเงินกลุ่ม: handles routes (evidence: `netlify/functions/api.js`)
- API หลัก → Audit และแจ้งเตือน: writes records (evidence: `netlify/functions/api.js`)
- การเงินกลุ่ม → ฐานข้อมูล client: stores transactions (evidence: `netlify/functions/api.js`)
- Audit และแจ้งเตือน → ฐานข้อมูล client: stores logs (evidence: `netlify/functions/api.js`)
