Skip to content

2way-meeting-backoffice

2way-meeting-backoffice (branch: prod, 521 tracked files) เป็น Next.js frontend สอง persona ในแอปเดียว:

  1. Backoffice แอดมิน — path ใต้ /2wayfrontend/2waybackoffice/... ผ่าน src/features/BackOffice/*
  2. LINE LIFF ฝั่งพนักงาน — path ใต้ /line/... และ /line-cu/... ผ่าน src/features/2way/*

ชื่อ package จริงคือ reportmonitor เวอร์ชัน 5.0.0 (2way-meeting-backoffice/package.json:2-3) ไม่ตรงกับชื่อ repo — ร่องรอยว่าต่อยอดจากโปรเจกต์ตั้งต้นอื่น (pattern เดียวกับ 2way-api / 2way-batch / 2way-line-service)

ชื่อ "meeting" ใน repo ทำให้เข้าใจผิด — จากโค้ดจริง ไม่มีความเกี่ยวข้องกับ Meeting Platform / meeting-vtrc-api เลย ยืนยันจากรายชื่อ feature folder ทั้งหมดใน src/features/2way/ และ src/features/BackOffice/ (Announce, Survey, Complaint, Incident, Problem, ChatCenter, Question, Feedback, Satisfaction — ไม่มี Meeting) และ next.config.js ตั้ง basePath: "/2way-backoffice" (2way-meeting-backoffice/next.config.js:38-39)

Stack

ส่วนเทคโนโลยีเวอร์ชันอ้างอิง
FrameworkNext.js (Pages Router)12.0.7package.json:44
UIReact 17, MUI v5 + Material-UI v4 (ปนกัน)17.0.2, 5.2.4, ^4.12.3package.json:47,25,23
StateRecoil^0.5.2package.json:53
i18nnext-i18next (th/en, default th)^10.0.1package.json:45, next-i18next.config.js:2-6
Realtimesocket.io-client^4.5.1package.json:56
LINE@line/liff^2.18.2package.json:22
Error tracking@sentry/nextjs^6.16.1package.json:29
HTTPaxios (wrapper เอง — ไม่ใช้ SWR/React Query)^0.24.0package.json:34
Package manageryarnDockerfile:7 (yarn install --frozen-lockfile)

Entrypoint / พอร์ต

Scriptคำสั่งพอร์ตอ้างอิง
devENV_STAGE=development next dev -p 80028002package.json:7
startnext start -p 80028002package.json:9
buildnext buildpackage.json:8
out / exportnext build && next exportstatic exportpackage.json:9,14
Dockernext start, EXPOSE 80028002Dockerfile:34-37

Next.js mount ทั้งแอปใต้ basePath / assetPrefix = /2way-backoffice (next.config.js:38-39) ดังนั้น URL จริงใน browser คือ /2way-backoffice/... ก่อน path ของ Pages Router

Backend ที่เชื่อมจริง (ยืนยันจากโค้ด)

Backendenv (shell) → process.env.* (client)ค่า productionหลักฐานฝั่ง client
2way-api (NestJS)APP_CONNECT_APIappConnectAPIhttps://vtrcapi.redcross.or.th/2way-api (.env.production:6)Login POST .../api/v1/auth (Login/components/Form.tsx:99); verifyToken (withAuthVerify.tsx:27); surveys/announces/employee/complaints ผ่าน fetchAPI
chat-center-apiAPP_CONNECT_API_CHATappConnectChatCenterAPI และ chatCenterPath.../chat-center-api/api/v1 (.env.production:7); path สั้น chat-center-api/api/v1 (next.config.js:73)utils/chatCenterApi.tsx + ChatCenter/index.tsx:88,109,131
2way-vtrc-api (Express legacy)APP_CONNECT_API_BASICappConnectChatAPIhttps://vtrcapi.redcross.or.th/2way (.env.production:9)LIFF pages: /getProfile, /verifyUserLine, /getListFAQs ฯลฯ
incident-management-apiAPP_CONNECT_API_INCIDENTappConnectIncidentAPI.../incident-management-api (.env.production:8)services/line/incidents.tsx; ChatCenter problem list — repo ไม่มีใน workspace → UNVERIFIED
WebSocketAPP_WEBSOCKETappConnectWebSocketwss://vtrcapi.redcross.or.th (.env.production:11)io.connect(..., { path: "/chat-center-ws/socket.io" }) (ChatCenter/index.tsx:173-176)
RedCross host (chat-center via fetchRedCrossAPI)APP_PATHappConnectRedCrosshttps://vtrcapi.redcross.or.th (.env.production:10)fetchRedCrossAPI ประกอบ ${appConnectRedCross}/${chatCenterPath}/... (fetchApiWithAxios.tsx:85)

UAT ใช้ host uat-vtrcapi.redcross.or.th แทน (/.env.uat:6-11)

ข้อค้นพบสำคัญเรื่อง data flow

  • ฝั่งพนักงาน (LIFF) พึ่ง 2way-vtrc-api (appConnectChatAPI) เป็นหลัก — ไม่ใช่ NestJS 2way-api
  • ฝั่งแอดมิน ใช้ 2way-api สำหรับ auth / surveys / announces / employee / complaints และใช้ chat-center-api สำหรับ ChatCenter + Satisfaction
  • env ชื่อ appConnectChatAPI ไม่ได้ ชี้ chat-center — ชี้ 2way-vtrc-api — ดู 03-persistence-integrations และ 04-scorecard OBS-2WAYMTBO-01

Deploy

  • Docker multi-stage (Dockerfile) — yarn build แล้ว copy .next + .env.production เข้า runner image
  • Bitbucket Pipelines (bitbucket-pipelines.yml) — build/test, Docker push ไป GCP Artifact Registry, Terraform apply บน branch cicd / prod (ดูรายละเอียดในบท 01)
  • Sentry config files มีอยู่ (sentry.client.config.js, sentry.server.config.js, _error.tsx) แต่ withSentryConfig(...) ใน next.config.js ถูก comment ออก (next.config.js:79-80) — source map upload ผ่าน webpack plugin จึงไม่ทำงานใน config ปัจจุบัน

สารบัญ

บทหัวข้อ
01Repository map — โครงสร้าง, pages/routes, layouts, CI
02Core pipeline — auth, login, LIFF, route guard, API wrappers
03Integrations — backends, ChatCenter team admin, Sentry
04Scorecard

ดูภาพรวมกลุ่ม 2way Platform ที่ Volume 5 index.