Files
pos-system/microservices/docs/audit/research-analyst.md
Ho Ngoc Hai 76d75c753b Migrate
2026-05-23 18:37:02 +07:00

10 KiB
Raw Permalink Blame History

Audit Report: POS System — Research Analyst Perspective

Date: 2026-03-20 Auditor: Research Analyst (TechBi Company) Scope: Tech stack relevance, outdated dependencies, market alignment Task Reference: TEC-231 (parent: TEC-217)


Executive Summary

GoodGo Platform là một monorepo enterprise-grade với 26 microservices (.NET 10), 5 frontend apps, và AI integration (MCP server). Tech stack hiện đại, phù hợp thị trường, và có kiến trúc Clean Architecture + CQRS được enforce nhất quán. Rủi ro chính là 3 services critical bị incomplete (inventory, promotion, mission) — trực tiếp chặn order fulfillment và marketing campaigns tại production.


Critical Issues

CRIT-01: 3 Services Thiếu Handler Implementation — Chặn Core Features

Severity: 🔴 Blocker / P0

Affected Services:

  • services/inventory-service-net/ — 12 controller endpoints nhưng chỉ có 1 command handler. Queries: 0. Không thể truy vấn tồn kho.
  • services/promotion-service-net/ — 0 commands, 0 queries. Controllers reference logic không tồn tại.
  • services/mission-service-net/ — 0 commands, 0 queries. Gamification engine hoàn toàn non-functional.

Business Impact:

  • Order fulfillment bị block (không validate stock)
  • Discount/voucher campaigns không hoạt động
  • Loyalty missions/gamification không chạy được

Evidence: ROADMAP.md đã track vấn đề này ở line 71. Services scaffold nhưng chưa được implement.

Recommendation: Ưu tiên P0 sprint cho 3 services này. Reference services/_template_dot_net/ cho patterns.


CRIT-02: Port Conflicts trong Docker Compose Local — Cản Local Development

Severity: 🔴 Critical / P0

Files: deployments/local/docker-compose.yml

4 marketing services (mkt-facebook, mkt-whatsapp, mkt-zalo, mkt-x) đều dùng port 5000, gây conflict khi start local stack đồng thời.

Business Impact: Developer không thể test marketing integrations locally, làm chậm development cycle.

Recommendation: Assign unique ports (ví dụ 5021-5024) cho 4 mkt-* services trong docker-compose.yml. Cập nhật Traefik service definitions tương ứng.


Warnings

WARN-01: Test Coverage Thấp (~15%) — Rủi Ro Production

Severity: 🟡 High / P1

Layer Coverage Estimate
iam-service-net ~40%
order-service-net ~25%
fnb-engine-net ~35%
Tất cả services còn lại ~510%
Trung bình toàn hệ thống ~15%

371 test files tồn tại (*.cs trong thư mục tests/) nhưng phân bổ không đều. Nhiều services production-ready chưa có functional tests.

Recommendation: Target 50%+ coverage (unit + functional) trước khi scale thêm merchants. Ưu tiên: wallet, catalog, booking services.


WARN-02: ads-serving Service Chỉ Read-Only

Severity: 🟡 Medium / P2

services/ads-serving-service-net/ — tất cả endpoints là read-only, 0 command handlers. Ad auction logic và budget management không thể được điều khiển qua API.

Business Impact: Ads revenue pipeline bị giới hạn, không thể quản lý ads dynamically.


WARN-03: Mobile Apps Chưa Complete

Severity: 🟡 Medium / P2

  • apps/app-client-base-net/ (MAUI) — scaffold, 0 pages implemented
  • apps/app-client-base-swift/ (SwiftUI iOS) — in-progress, 34 files nhưng thiếu POS workflow

Business Impact: GoodGo không có native mobile POS app. Cạnh tranh với KiotViet, Sapo (đều có mobile app hoàn chỉnh).


WARN-04: K8s Secrets Dùng Placeholder Values

Severity: 🟡 Medium / P1

deployments/staging/kubernetes/secrets.yaml — chứa placeholder values thay vì sealed secrets thực tế.

Recommendation: Implement sealed-secrets operator (đã referenced trong codebase). Rotate tất cả staging credentials.


WARN-05: PostgreSQL Exporter Chưa Configure

Severity: 🟡 Low / P2

infra/observability/prometheus.yml đề cập pg_exporter nhưng chưa deploy. DB metrics (connections, query latency, replication lag) không được collect.

Recommendation: Deploy postgres-exporter sidecar hoặc standalone. Thêm vào Prometheus targets và Grafana dashboard.


Improvements

IMP-01: Payment Integration — Mở Rộng Sang Momo, ZaloPay

Priority: High (Competitive)

Hiện tại: VNPay sandbox integrated. Chưa có: MoMo, ZaloPay — 2 ví điện tử phổ biến nhất tại Việt Nam (chiếm ~60% digital payment market share).

Market Context: Theo NAPAS 2025, thanh toán không tiền mặt tăng 40% YoY tại SMB sector. KiotViet và iPOS đều đã tích hợp đầy đủ.

Recommendation: Tạo payment adapter pattern trong wallet-service-net/, implement MoMo QR (IPN webhook) và ZaloPay API. Roadmap: Q2 2026.


IMP-02: Regulatory Compliance — Nghị Định 123/2020 (E-Invoice)

Priority: High (Legal Requirement)

Từ 01/07/2022, tất cả businesses tại VN bắt buộc dùng hóa đơn điện tử (e-invoice) theo Nghị định 123/2020/NĐ-CP. GoodGo order service cung cấp invoice data nhưng chưa integrate với nhà cung cấp hóa đơn điện tử (VNPT, Viettel, FastBill).

Recommendation: Tạo einvoice-service-net hoặc integration layer trong order-service. Ưu tiên đối tác: VNPT Invoice hoặc Viettel-CA.


IMP-03: AI/MCP Server — Mở Rộng Từ F&B Sang Các Vertical Khác

Priority: Medium (Differentiation)

services/goodgo-mcp-server/ có 12 tools AI cho F&B. Đây là điểm khác biệt lớn so với KiotViet, Sapo, iPOS (không có AI). Tuy nhiên chưa có tools cho: Karaoke (room optimization), Spa (therapist scheduling AI), Retail (demand forecasting).

Recommendation: Roadmap thêm 8-10 MCP tools cho Karaoke và Retail verticals trong Q3 2026. ROI cao: AI features → premium tier justification.


IMP-04: Observability — Thêm Business Metrics

Priority: Medium

Hiện tại Prometheus + Grafana tốt cho infrastructure metrics. Chưa có business metrics (orders/giờ, conversion rate, churn per merchant, revenue per vertical).

Recommendation: Implement custom Prometheus gauges trong order-service, wallet-service. Tạo Grafana dashboard "Business KPIs" cho Product team.


IMP-05: Caching Strategy — Redis Chưa Được Tận Dụng Fully

Priority: Low / Medium

Redis đang được dùng làm SignalR backplane. Chưa thấy application-level caching cho:

  • Catalog (menu items) — thường xuyên đọc, hiếm thay đổi
  • Membership levels — static data
  • Shop configuration — read-heavy

Recommendation: Implement IMemoryCache + Redis distributed cache cho catalog và shop config. Giảm DB load, tăng response time.


Action Items

# Item Priority Owner Timeline
1 Implement inventory-service commands + queries (stock check, adjust, reserve) P0 🔴 Backend Dev Sprint 1
2 Implement promotion-service (create/apply discount, voucher validation) P0 🔴 Backend Dev Sprint 1
3 Implement mission-service (create mission, track progress, complete mission) P0 🔴 Backend Dev Sprint 2
4 Fix Docker Compose port conflicts (mkt-* services: assign 5021-5024) P0 🔴 DevOps Sprint 1
5 Rotate staging secrets, implement sealed-secrets operator P1 🟡 DevOps Sprint 1
6 Increase test coverage: wallet, catalog, booking services (target 50%) P1 🟡 QA + Devs Sprint 2-3
7 Integrate MoMo QR + ZaloPay API trong wallet-service P1 🟡 Backend Dev Q2 2026
8 E-invoice integration (Nghị Định 123/2020) — VNPT hoặc Viettel-CA P1 🟡 Backend Dev Q2 2026
9 iOS app (SwiftUI) — complete POS workflow cho Restaurant vertical P2 🟡 Mobile Dev Q3 2026
10 Expand MCP AI tools sang Karaoke + Retail verticals P2 🟡 Backend Dev Q3 2026
11 Deploy postgres-exporter, add Business KPI Grafana dashboard P2 🟡 DevOps Sprint 3
12 Implement Redis application-level caching (catalog, shop config) P3 🟢 Backend Dev Q3 2026

Market Alignment Summary

Dimension GoodGo KiotViet Sapo POS iPOS Assessment
Multi-vertical (5+) 🟡 🟡 Competitive advantage
AI-powered features Unique differentiator
Real-time POS (KDS) Competitive parity
Microservices scalability Enterprise advantage
Mobile app (production) 🔴 Critical gap
Payment (Momo/ZaloPay) 🔴 Critical gap
E-invoice compliance 🟡 Legal requirement
Loyalty + Marketing CRM Competitive parity

Overall Assessment: GoodGo có kiến trúc và AI capabilities vượt trội so với đối thủ VN, nhưng bị chặn bởi incomplete features và thiếu payment integrations phổ biến tại VN. Sau khi fix P0 items và thêm MoMo/ZaloPay, positioning sẽ rất mạnh cho enterprise SMB segment.


Tech Stack Assessment

Đánh giá tổng thể: Modern, Production-Grade, No EOL Risks

Component Version Industry Standard Assessment
.NET / C# 10.0 / 14 8.0+ (LTS) Ahead of curve
MediatR 12.4.1 12.x Current
EF Core + Npgsql 10.0 / 10.0 8.0+ Current
Duende IdentityServer 7.0.8 7.x Current
Blazor WASM .NET 10 .NET 8+ Current
MudBlazor 8.15.0 8.x Current
Kubernetes RKE2 1.28+ Production-grade
Traefik v3.3 v3.x Current
PostgreSQL 16 15/16 Current
TypeScript 5.9.3 5.x Current
Node.js 25+ 22 LTS ⚠️ Using non-LTS; consider 22 LTS

Note: Node.js 25 là Odd release (non-LTS). Recommend tracking Node.js 22 LTS cho stability, nếu không có specific reason để dùng 25.


Audit completed: 2026-03-20 | Research Analyst — TechBi Company Task: TEC-231 | Parent: TEC-217