
Shopify × Daftra Integration System
A production automation system built for a Gulf-region 3PL warehouse operator. Eliminated a fully manual fulfillment workflow by bridging Shopify storefronts with Daftra ERP — every incoming merchant order instantly triggers invoice creation and stock deduction with zero human intervention and a complete audit trail.
Scope of Work
- •Real-time Shopify webhook processing for order creation, updates, and cancellations
- •HMAC signature verification on every incoming webhook request
- •Multi-merchant architecture — each merchant operates with fully isolated credentials
- •Vendor-based line-item filtering to process only relevant products per merchant
- •Dual product code resolution: barcode lookup first, SKU prefix fallback
- •Automatic Daftra sales invoice creation with real-time stock deduction
- •Order update sync using GET-then-PUT to preserve existing invoice data integrity
- •Order cancellation handled via Daftra refund receipts with precise item record targeting
- •Deduplication guard prevents double-processing of already-handled orders
- •Transactional email notifications covering invoice creation, updates, and cancellations
- •Next.js admin dashboard for merchant onboarding and credential management
- •Sync log viewer with granular status tracking: success, failed, ignored, cancelled, updated
- •Docker Compose deployment with nginx as a unified reverse proxy entry point
- •Basic Auth enforcement on all admin endpoints via nginx
Tech Stack
What We Did
Shopify stores POST webhooks to nginx → Express backend (port 3000). nginx proxies the browser dashboard to Next.js frontend (port 3001) and admin API routes to the backend with Basic Auth. PostgreSQL stores merchants and sync_logs. All services are Docker Compose containers sharing an internal network. The /webhook route uses express.raw() — never express.json() — to preserve the raw body for HMAC verification.
Outcomes
Replaced a fully manual warehouse fulfillment process with an end-to-end automated pipeline. Every Shopify order across all connected merchants now instantly generates a Daftra invoice and deducts stock in real time — no human involvement, no missed orders, and a full sync history for auditing and debugging.