Skip to main content

Architecture Overview

The Middleware Platform is a Laravel 11 monolith deployed on AWS via Laravel Vapor. It follows a service-oriented internal architecture separated into distinct layers.


Request Flow

External Service (nFusion / ShipStation / WooCommerce)


API Routes (routes/api.php)


HTTP Controllers
├── ImageAPI — CertiLock serial-number image retrieval
├── ShipStationWebhookController — ShipStation order/ship events
└── WooCommerceProductUpdateController — Product sync from WooCommerce


Services Layer
├── NFusionService — Fetches live pricing data from nFusion API
├── PriceSyncService — Orchestrates sync across all tenants & targets
└── ShipStationService — Fetches order data from ShipStation REST API


SyncTarget Providers
├── AlgoliaSyncTargetProvider
├── WooCommerceSyncTargetProvider
└── HttpSyncTargetProvider


Eloquent Models / Database (MySQL)

Key Directories

PathPurpose
app/Http/Controllers/Inbound request handlers for API and webhooks
app/Services/Business-logic services (NFusion, PriceSync, ShipStation)
app/SyncTargets/Provider implementations per sync target type
app/Filament/Filament admin pages, resources, and actions
app/Jobs/Queued jobs (NFusionSyncTenantPricesJob)
app/Models/Eloquent models for tenants, targets, sync logs, products, shipping
app/Enums/PHP enums for precious metals, tenant status, sync log status
config/nfusion.phpnFusion-specific configuration (timeout, etc.)
config/sync-targets.phpRegistry of available sync target provider classes

Deployment

The application is deployed via Laravel Vapor (serverless on AWS Lambda), configured in vapor.yml. Each environment (staging, production) maps to a separate Vapor environment with its own environment variables and database connection.


Queue Architecture

Long-running price sync operations are offloaded to Laravel queues:

  • Queue name: nfusion
  • Job: NFusionSyncTenantPricesJob
  • Driver: Redis (production) or Database (local)

The job is dispatched on a schedule defined in app/Console/Kernel.php (or Laravel 11 schedules in routes/console.php).