Lewati ke isi

Sentra Automotive — Architecture & Tech Stack Delta

System Architecture

SentraAuto Care mengadopsi arsitektur Distributed Cloud Architecture with Offline-Capable Branch Edge Sync Nodes untuk menjamin operasional bengkel tetap berjalan lancar saat koneksi internet lokal bermasalah.

3.1 C4 Container Diagram

graph TB
    subgraph "Client Applications"
        SA_Tablet["Service Advisor Tablet App (React Native)"]
        MechanicTablet["Mechanic Bay Tablet App (React Native)"]
        StorekeeperApp["Gudang Storekeeper App (Electron / React)"]
        CashierApp["Cashier POS Console App (React Desktop)"]
    end

    subgraph "Branch Edge Server — Local Workshop Node"
        LocalProxy["Go-Edge Sync Daemon & MQTT Broker"]
        LocalSQLite[("Local SQLite Cipher DB — Encrypted")]
        BarcodeServer["Local Barcode Server Integration"]

        LocalProxy --> LocalSQLite
        BarcodeServer --> LocalProxy
    end

    subgraph "AWS Cloud Platform — Enterprise Monolith"
        APIGateway["AWS API Gateway & Load Balancer"]

        subgraph "Modular Monolith Core"
            CoreEngine["Core NestJS Engine"]
            InventoryManager["Inventory & Warehouse Manager"]
            BillingService["Billing & POS Manager"]
            PayrollEngine["Mechanic Payroll Engine"]
        end

        CloudDB[("PostgreSQL Primary Multi-Branch DB")]
        CacheStore[("Redis Cluster for Parts Catalog & Sessions")]
        JobQueue["RabbitMQ Notification & Sync Queue"]

        CoreEngine --> CloudDB
        CoreEngine --> CacheStore
        InventoryManager --> CloudDB
        BillingService --> CloudDB
    end

    subgraph "External Integrations"
        PaymentGateway["Midtrans / Xendit Payments"]
        WAService["WhatsApp Gateway API (Twilio)"]
    end

    SA_Tablet --> LocalProxy
    MechanicTablet --> LocalProxy
    StorekeeperApp --> LocalProxy
    CashierApp --> LocalProxy
    LocalProxy <--> APIGateway
    APIGateway --> CoreEngine
    CoreEngine --> PaymentGateway
    CoreEngine --> WAService

3.2 Offline Workbay Operations Sync Protocol

Bengkel tidak boleh terhambat karena koneksi internet lambat:

  1. Setiap data Work Order (WO) yang dibuat Service Advisor dicatat secara lokal ke database SQLite terenkripsi lokal cabang.
  2. Mekanik melakukan checkout sparepart dan kasir mencetak invoice menggunakan database lokal ini.
  3. Peristiwa perubahan stok dan penagihan kasir diantrekan ke tabel outbox sync_event_logs lokal dengan version vector timestamp.
  4. Begitu daemon mendeteksi status internet kembali online, sistem melakukan bi-directional synchronization ke AWS Cloud secara transparan menggunakan teknik penanganan konflik CRDT (Conflict-Free Replicated Data Types) dengan prioritas data master server.

Tech Stack — Automotive Delta

Baseline: _shared/tech-stack-baseline.md

Overrides

  • Service Advisor & Cashier ClientReact 19 & Electron (override: butuh koneksi hardware printer POS dan terminal pembayaran kartu EDC via port serial; Electron memungkinkan akses native serial port di Windows).
  • Message QueueRabbitMQ (override: digunakan sebagai notification & sync queue di automotive, berbeda dengan BullMQ di baseline — dipilih karena kebutuhan multi-consumer MQTT broker di edge node).

Tambahan Sistem-Spesifik

  • Go-Edge Sync Daemon: Go daemon berjalan sebagai local proxy di setiap cabang bengkel, berfungsi sebagai MQTT broker untuk komunikasi real-time antara tablet mekanik, terminal gudang, dan kasir di LAN lokal bengkel tanpa melalui cloud.
  • Offline CRDT Sync: Tabel outbox sync_event_logs di SQLite lokal mengimplementasikan CRDT (Conflict-Free Replicated Data Types) untuk resolusi konflik data saat re-sync ke cloud setelah koneksi internet pulih.
  • Mechanic Workbay App (React Native): Dideploy ke tablet Android industri tahan benturan (rugged tablets) di bay mekanik — antarmuka dioptimalkan untuk penggunaan sarung tangan.
  • Local Barcode Server Integration: Go service menerima event dari handheld barcode scanner di gudang via serial/USB dan meneruskan ke Go-Edge Sync Daemon untuk diproses sebagai pick-slip dispense event.
  • RabbitMQ Notification Queue: Worker notifikasi WhatsApp dan service reminder H+90 dikonsumsi dari RabbitMQ queue di cloud setelah event billing/WO terselesaikan.