B2B Purchase Order Integration Platform
Backend Featured

B2B Purchase Order Integration Platform

A self-hosted B2B integration platform that exchanges Purchase Orders, Delivery Notes, and Sales Order confirmations between buyer and seller ERPs over REST and OAuth2, with a transactional-inbox outbound pipeline and a buyer-agnostic adapter driven by JSON configuration.

Overview

A production-shaped B2B order-integration platform that replaces email/spreadsheet workflows with REST/JSON over HTTPS, using OAuth2 client-credentials and JWT for submit/update/confirm/reject/cancel/version operations on Purchase Orders and Delivery Notes. Built on Node.js + TypeScript with a buyer-agnostic JSON-configured adapter, so new trading partners are onboarded by configuration rather than by writing new integration classes.

Key Features

  • Buyer-agnostic DefaultBuyerAdapter driven by a JSON adapterConfig (field resolver + body mapping), with per-buyer Swagger generated from the integration definition
  • Full version-history chain for PO and DN with supersession tracking across submit / update / confirm / reject / cancel / version operations
  • Transactional Inbox pattern with exponential-backoff retry and a dead-letter queue so messages survive restarts and transient failures
  • Distributed locking on a MySQL-backed scheduler (ScheduledJob / JobExecution) to prevent duplicate workers from double-processing
  • OAuth2 client-credentials + JWT bearer auth with JSON Schema validation via AJV on every inbound payload
  • DocSendWorker with per-document send logs, pdfkit-based PO PDF generation, and SSE event streams for live UI updates
  • Grafana Loki logging via a crash-safe file-queue worker, Docker Compose deployment, health checks on every service

Architecture

Component Details
Auth portal & admin Next.js 16 app acting as the OAuth2 authorisation server and admin console for clients, trading partners, adapter configs, and JWT issuance
Operations portal Next.js 16 + React UI for sellers and buyers to browse, confirm, reject, and reconcile PO/DN documents with SSE live updates
API service Node.js + TypeScript on Express 5 exposing submit/update/confirm/reject/cancel/version endpoints with AJV JSON Schema validation
Database MySQL 8 via Prisma 7 — version-history chain, supersession links, Transactional Inbox, dead-letter queue, send logs, scheduler tables
Scheduler MySQL-backed ScheduledJob / JobExecution with distributed locking, driving exponential-backoff retries across restarts
DocSendWorker Outbound dispatcher using the buyer-agnostic DefaultBuyerAdapter with JSON adapterConfig and pdfkit PO PDF generation
Logging Grafana Loki pipeline with a crash-safe file-queue worker and structured logs from every service
Deployment Docker Compose with production Dockerfiles and health checks, install guides for Windows Server 2025 and Ubuntu

Tech Stack

Node.jsTypeScriptExpressPrismaMySQLNext.jsReactOAuth2 / JWTAJV JSON SchemaDocker

Details

Category Backend
Technologies 10
Status Published
Featured Yes

Gallery

screenshot_1.png
screenshot_2.png
screenshot_3.png

Related Portfolio