← All workStory 01 of 03 · 6 min read

CPAxtra (Makro) · Lead Software Engineer · 2026 to now

Tax refunds at the till, wired straight to the bank.

How I architected E-VRT, an electronic VAT refund platform, inside Store Hub, alongside a third platform for automated insurance claims.

My role
Architecture, API design, integration, roadmap
Team
Frontend, Backend, DevOps, QA, Product
Platforms
Store Hub · E-VRT · Insurance Claims, in 164 Makro wholesale stores across Thailand
Stack
Next.js, NestJS, Kafka, BullMQ/Redis

The problem.

Tourists can claim back VAT on what they buy. To do that electronically, every refund has to be issued in-store, verified, signed and confirmed by the bank, and staff must be able to track, edit or cancel it at any time.

The hard parts:

  1. It's money: every message to the bank must be signed and verifiable
  2. External partners can be slow or down, but a refund can never be lost
  3. It had to live inside Store Hub, which other teams were shipping at the same time

How it fits together.

  1. Store Hub · Next.js shell

    • E-VRT module
    • Insurance Claims module
    • Retail ops modules

    Micro-frontends via Module Federation

    Identity

    SSO + fine-grained RBAC

    One sign-in, per-action permissions

  2. E-VRT API · NestJS

    Issue refund · track status · edit · cancel. API contracts defined up front.

  3. Events · Kafka + BullMQ / Redis

    • Refund jobs
    • Batch retries
    • Business notifications
  4. Bank · KTB

    JWS-signed requests and responses

    External

    Tourist verification service

Simplified and sanitized. The orange dots are refund requests moving through the system.

4 calls I made.

  1. 01

    Never call the bank in the request path

    Refunds become jobs on Kafka and BullMQ, with batch retries. The cashier gets an instant answer, and a slow bank only delays a refund instead of losing it.

  2. 02

    Sign everything

    Every message to KTB is JWS-signed and verified both ways, so any refund can be proven later: who asked, what was sent, what the bank replied.

  3. 03

    Ship E-VRT as a module, not a fork

    Module Federation let E-VRT plug into Store Hub and release on its own schedule, without blocking the teams shipping other modules.

  4. 04

    Standardize the backend on NestJS

    Moved from Rust/Axum: one language (TypeScript) across the stack, faster feature delivery, and a mature ecosystem for SSO, queues and observability.

What shipped

  • A production E-VRT platform inside Store Hub: issue, track, edit and cancel refunds
  • A secure KTB integration with JWS signing, tourist verification and batch retries
  • Insurance Claims connected to incident tracking, with SLA tracking and audit-ready dashboards
  • Monoliths split into services and async workers, so releases carry less risk and cause less downtime
  • 3 platforms on one architecture serving 164 Makro wholesale stores across Thailand, led across 5 disciplines and released through 4 environments (DEV, QA, UAT, PROD)

AI vs. me

Agents

Agents scaffolded NestJS modules and DTOs from the API contracts, drafted tests and migrations, and handled repetitive refactors during the service split. I reviewed every diff.

Me

The architecture, the bank security model, the retry design, and every security review.

Tools: Claude Code, Cursor, GitHub Copilot, ChatGPT / Codex

What I'd do differently.

I'd agree the error and retry contract with the bank before designing the queues: which failures are safe to retry, and how long a refund may stay pending. Settling that up front makes the retry design simpler and sign-off faster. I'd also add contract tests between Store Hub and the E-VRT module from the first sprint, so independent Module Federation releases can't break each other.