work/Backend · Integration
Two-way sync · WooCommerce connector

Webshop × Pantheon

A middleware service that connects a webshop to the Pantheon ERP in both directions - orders, statuses, stock, prices and products stay aligned, and every sale ends as a fiscalized invoice in the customer's inbox. A platform-independent core, one connector per platform. First connector: WooCommerce.

Role

Backend architecture · integration build · delivery

Stack

NestJS · BullMQ · PostgreSQL

Year

2026

Status

In progress

architecture · two-way sync
SourceWebshop
webhook / canonical JSON
Process 01Receiver
200 · enqueue
BrokerRedis Queue
job
Process 02Worker
stored procs
ERPPantheon
└▶
ERPPantheon
status + JIR
Process 02Worker
connector
ChannelWebshop
PDF · SMTP
RecipientCustomer
2-wayOrders, statuses and catalog - both ways
0Manual re-keying between systems
0%Sales to a fiscalized invoice
The challenge

What this solves.

Trade runs on the webshop, the business runs in the Pantheon ERP - and the two are separate worlds. Orders are re-keyed by hand, statuses drift apart, stock and prices disagree, and Croatian fiscalization happens - if at all - as a separate manual step.

Nobody asked for this, because everyone assumes it cannot work any other way. We built a service that forces the two systems to behave as one: a sale shows up in Pantheon at once, status changes mirror both ways, the catalog stays aligned, and the customer gets a correct fiscalized invoice - without anyone touching it.

Our approach

The core is platform-independent. The connector isn't.

The service stands on the same foundations as our one-way Pantheon middleware - only it runs both ways. Everything specific to a given store lives in a thin connector; everything beneath it - the job queue, ERP writes, fiscalization, PDF, email, audit trail - is shared and does not change from platform to platform.

The inbound flow works with any webshop. An order arrives either through a platform connector, or directly as our canonical JSON on the published endpoint. A store that can send an HTTP request can send orders - no connector, no waiting on us.

The return flow needs a per-platform connector. To push a status, a stock level or a price back into the store, we have to speak its API. So the connector is a tightly bounded interface with a handful of operations - fetch order, set status, update stock and price, upsert product. A new connector means implementing that interface, not building a new service.

WooCommerce is the first connector - REST API and webhooks, fully covered and integration-tested. The same shape applies to Shopify, Magento, PrestaShop or a custom store.

Capabilities

What the service does, on any platform.

  • Orders in. An order is written into Pantheon through stored procedures - never a direct write into tables - after the customer is ensured, with document numbering staying owned by the ERP.
  • Status both ways. Store → ERP (paid, cancelled) and ERP → store (confirmed, processing, shipped, completed), with idempotent transitions that create neither loops nor duplicate events.
  • Stock, prices and products - both ways. Whether the change starts in the store or in Pantheon.
  • Croatian fiscalization, built in-house. ZKI generation, digitally signed XML (XML-DSig), exchange with FINA's service, JIR and a QR code on the invoice. No intermediary, no third-party fiscalization service.
  • Invoice in the inbox. A PDF rendered by headless Chromium and emailed to the customer over SMTP the moment the sale is fiscalized.
  • Resilient & idempotent. A durable job queue with retries and exponential backoff, crash-safe state, dead-letter handling, and automatic reconnect to both the store and the ERP.
  • Observable. Structured JSON logging with a correlation ID across the whole event lifecycle, health and readiness probes for every dependency, and a job-queue dashboard.
  • Configurable business rules. Status mapping, warehouses, tax rates, discounts and invoice templates are per-environment configuration, not code changes.
Architecture

One service, two directions.

Process 01

Receiver

Receives events from the store - a signature-checked webhook, or canonical JSON with token authentication. Validates, enqueues the job and returns 200 OK immediately. The store never waits on the ERP.

Process 02

Sync Worker

Writes orders into Pantheon, mirrors statuses, syncs stock, prices and products, fiscalizes and emails the invoice - pushing ERP changes back into the store through the connector, with retries at every step.

Both connections - the store and the Pantheon ERP - reconnect automatically after a drop. Local state, idempotency keys and the audit record live in PostgreSQL, with Redis as the broker. The ERP and the store are the sources of truth; the middleware holds only what it needs to never lose or repeat a job.
What syncs

Everything that drives a sale.

New orderWebshop PantheonOne-way
Order statusWebshop PantheonTwo-way
Stock, prices and productsWebshop PantheonTwo-way
FiscalizationZKI / JIR · FINA
InvoicePDF → customer emailOne-way
Supported stores

Three ways to connect.

  • WooCommerce - a full connector, REST API and webhooks. Integration-tested.
  • Any store, inbound flow - orders are posted as canonical JSON to our published endpoint, against the OpenAPI/Swagger spec. No connector needed.
  • Other platforms, full two-way flow - Shopify, Magento, PrestaShop or a custom store, by implementing the same connector interface. The core stays untouched.
Security & handoff

Least privilege, nothing in the clear.

  • Signature verification on incoming webhooks and token authentication on the canonical endpoint; anything that fails the schema is rejected.
  • No direct writes into ERP tables; a dedicated integration user instead of an admin account.
  • Secrets, API keys and certificates come from the environment only - never in the repository or the image.
  • Source-free delivery: the app is packaged into the image compiled to V8 bytecode, so readable source never reaches anyone else's infrastructure. Only the image ships.
Hosting

Two ways to host it.

The service ships as a Docker image, so it runs the same anywhere - and the merchant picks where.

Option 01

On the merchant's infrastructure

The service runs inside their network, next to Pantheon, without exposing the ERP outward. They get the image, docker-compose configuration and runbooks for deploy, backup and rollback. Data never leaves their environment, and we stay available for support and upgrades.

Option 02

On ours, as a managed service

We run, monitor and maintain the service, with separate production and test environments. The merchant gets a URL and credentials, and never has to think about the server, updates or certificates. All it takes is a secure network path to their Pantheon instance.

Either way it is the same code, documentation and behaviour - the only difference is who holds the server.
The stack

Chosen for reliability.

Runtime / languageNode.js 20+ · TypeScript 5 (strict)
FrameworkNestJS 10
Job queueBullMQ + Redis
State storePostgreSQL + Prisma
Store interfacePer-platform connector (WooCommerce REST + Webhooks) · canonical REST endpoint
ERP accessMS SQL Server - direct TDS, stored procedures
FiscalizationSigned XML (XML-DSig) · node-forge · QR codes
Invoice PDFHeadless Chromium (Puppeteer)
EmailSMTP (Nodemailer)
Observabilitypino · Swagger / OpenAPI · Bull Board
DeliveryDocker + Docker Compose
Who it's for

Middleware, not a one-off integration.

The service is built as a product, not as a bespoke build for a single merchant. The core, the Pantheon access layer and the fiscalization layer are generic; what differs from store to store - credentials, certificate, warehouses, status mapping, tax rates, invoice templates - is environment configuration.

For a store on a supported platform, onboarding comes down to configuration and a check on the test environment - not a new development cycle. For a new platform, a connector is added; everything else already exists and already runs in production.

Status

Where it stands.

The project is in active development. The whole loop is built and integration-tested against a live Pantheon instance and a staging store: order in → customer ensure → ERP order → status mirroring → fiscalization → PDF → email.

Containerized and observable. The production fiscalization-certificate cutover is documented as a runbook - the same procedure already carried out on our one-way Pantheon middleware, which is in production.

in active development · live Pantheon + staging store
  • order ingest (webhook + canonical endpoint)
  • customer ensure
  • ERP order & invoice
  • status mirrored both ways
  • stock, price and product sync
  • fiscalization (ZKI / JIR)
  • invoice PDF emailed
  • containerized + observable
  • WooCommerce connector
  • production cert cutover
  • further connectors (Shopify, Magento)
Next project

UKCA

OPEN FOR NEW PROJECTS

Have a project like this one?

Tell us what you're building. We'll come back within one business day with a clear plan, a timeline, and a real human to talk to.