Skip to content

Simulator — def-exsport-3rdparty-simulator

A reverse proxy that sits in front of the three real third-party APIs, with a dashboard to force error responses per service. In dev the backend points at this instead of the real APIs.

How this page was verified

Read on 2026-09-15 from index.js, views/ and package.json. Local checkout: /Volumes/xpro/erisristemena/nodejs/def-exsport-3rdparty-simulator.

Stack

Express 5.1, http-proxy 1.18, ejs (dashboard views), axios, dotenv. Plain JavaScript. Scripts: start = node index.js, start:dev = nodemon index.js. Port from PORT (default 3000). Single-branch: main only.

What it does

It proxies three route prefixes to the real services (each target overridable by env):

RouteDefault target
/biteship/*api.biteship.com
/wms/*open-api.powerbiz.asia
/doku/*api-sandbox.doku.com

An in-memory errorSimulation object ({wms, doku, biteship}, all default off) is toggled at runtime by POST /simulate/:service with {enable}, and shown on an EJS dashboard at GET /. When a service is toggled on, its key endpoint returns HTTP 500: Biteship /v1/draft_orders, WMS /order/create, DOKU any call. It also logs request/response metadata (bounded by LOG_BODY_MAX_BYTES, default 8192; toggle ENABLE_PROXY_RESPONSE_BODY_LOGGING).

This is why "payment / delivery / WMS is failing on dev" is often not a backend bug — check the dashboard first. In dev the backend base URLs point here, at https://proxy.exsport.bdt.dev/{biteship,doku,wms}. See Third parties.