Skip to main content

Generated page. Written from IdaMilk/Suntado_EDI at commit 57b2e4f on 2026-07-28, version 1.4.2. There is no README, but EDI_INTEGRATION_SPECS.txt and NETSUITE_INTEGRATION.md document the system well.

Suntado EDI

What is it?

The service that speaks X12 EDI with trading partners. It parses inbound documents, generates outbound ones, manages the interchange control numbers that keep both sides in sync, and moves files over whichever transport a given partner uses.

Purpose

Retail and distribution partners exchange business documents as X12 EDI — a fixed, decades-old format with strict envelope and sequencing rules. Getting it wrong means rejected documents and, downstream, missed shipments.

This service concentrates that correctness in one place, so the rest of the platform deals in ordinary JSON and never has to think about segment terminators or control number sequencing.

How it Works

Two registries drive everything, which is what makes onboarding a new partner a configuration change rather than a code change.

partnerRegistry.js holds one entry per trading partner: which inbound transaction sets they send and which parser handles each, which outbound sets Suntado sends them and which generator builds each, and the ISA/GS envelope identifiers and qualifiers for both sides. Each partner also carries an active flag, and the registry ships a SENDERID template entry (inactive) to be copied when adding a partner.

transactionRegistry.js maps transaction set numbers to their handlers.

An inbound document arrives, is parsed by lib/x12/ into segments, dispatched by partner and transaction set to the right parser in edi/mappers/inbound/, and turned into a business object the rest of the platform understands. Outbound runs the same path in reverse through edi/mappers/outbound/, with lib/x12/envelope.js and generator.js assembling the ISA/GS/ST envelope and controlNumberService allocating the next control number.

Control numbers are the part that must not go wrong: X12 requires monotonically increasing interchange numbers per partner, and a duplicate or gap causes rejections. EDIControlNumber persists them in SQL Server rather than holding them in memory, so a restart cannot reissue a number.

pollingService and EDIPartnerPolling handle partners whose documents must be collected rather than pushed — polling their SFTP endpoint on a per-partner schedule.

Version 2.0 of the architecture is transport-agnostic. SFTP, API and AS2 are selectable per partner from configuration, with one generalised endpoint for all partners rather than one per partner. The v1.0 partner-specific endpoints still work for backward compatibility.

Supported transaction sets

SetDirectionDocument
846outboundInventory Inquiry / Advice
856outboundAdvance Ship Notice (ASN)
940bothWarehouse Shipping Order
943inboundWarehouse Stock Transfer Shipment Advice
944inboundWarehouse Stock Transfer Receipt Advice
945bothWarehouse Shipping Advice
947outboundWarehouse Inventory Adjustment Advice
824outboundApplication Advice
997bothFunctional Acknowledgement

The 940/943/944/945/947 cluster is third-party-logistics traffic — Suntado instructs a warehouse to ship, the warehouse reports back what moved. 846 publishes inventory availability to partners.

API

MountPurpose
GET /healthLiveness check
/edi/*EDI protocol operations — receive, send, generate
/api/edi/*Business-facing operations used by the rest of the platform

NETSUITE_INTEGRATION.md documents the inventory flow: a caller posts inventory data with SKU, UPC/GTIN, and available quantities in cases and pallets; the service generates an 846 and transmits it to the partner.

Data model

ModelHolds
EDITransmissionEvery document sent or received, with batch id
EDIControlNumberPer-partner interchange control number sequences
EDIPartnerPollingPer-partner polling schedule and state

Schema changes are tracked as SQL files in db/sql/ and applied deliberately, rather than through a boot-time migration — a different and arguably safer choice than the sibling services make.

Tech Stack

TechnologyVersionPurpose
Express5.2.1HTTP framework
node-x121.7.1X12 parsing and generation
ssh2-sftp-client12.1.1SFTP transport
Sequelize6.37.8ORM
tedious19.2.1SQL Server driver
pino10.3.1Structured logging
pino-pretty13.1.3Development log formatting
axios1.16.1Outbound HTTP
dotenv17.4.2Configuration

pino rather than morgan makes this the only service in the platform emitting structured JSON logs — genuinely useful when tracing one document through a batch.

Interfaces

SystemDirectionPurpose
Trading partnersbothDocument exchange over SFTP, AS2 or API
Suntado OpenAS2outboundAS2 transport
SunApps GatewayinboundProxies /api/edi here
NetSuitebothOrders, shipments and inventory, via the Core API
SQL ServeroutboundTransmission log and control numbers

Operations

Deployed by GitHub Actions — development, production and tagging workflows — and run under a process supervisor via ecosystem.config.js. Default port 4200.

When a partner reports a rejected document, the useful order is: EDITransmission for what was actually sent, then the 997 acknowledgement for what the partner objected to, then EDIControlNumber to confirm sequencing did not break.

Two operational notes:

  • lib/x12.old.js is still present alongside the current lib/x12/ module. Confirm which one a given path actually uses before editing.
  • Partner envelope identifiers live in source, not configuration — partnerRegistry.js carries ISA/GS sender and receiver ids per partner. Onboarding a partner is a code change and a deploy, not a config update.

Repository

RepositoryIdaMilk/Suntado_EDI
Version1.4.2
Primary languageJavaScript (Node, CommonJS)
Files124
Last activity2026-06-02
StatusActive
READMENone — but EDI_INTEGRATION_SPECS.txt (v2.0, January 2026) is a thorough technical spec, and NETSUITE_INTEGRATION.md covers the inventory flow

Note the package name is sunapps_edi while the repository is Suntado_EDI, and a separate, dormant SunApps_EDI repository also exists. This is the live one.