Skip to content

Fulfillment Monitoring

The fulfillment monitoring dashboard provides visibility into daily order fulfillment operations — metrics (Measurement Data) tracking successful and failed fulfillments anchored to calendar days (Temporal Regions). This is a read-only reporting surface that helps the Fulfillment team identify fulfillment issues early.

Goal: Surface daily fulfillment metrics (success/failure rates) so the Fulfillment team can detect problems before they cascade.

MethodPathSpecDescription
GET/api/fulfillment-daily-summaryfulfillment.yamlDaily fulfillment metrics, ordered by day descending
GET/fulfillmentsfulfillment.yamlList fulfillments (filter by phase, order, provider)
GET/fulfillments/{fulfillment_id}fulfillment.yamlSingle fulfillment detail
GET/analytics/commerce/ordersanalytics.yamlOrder analytics with group-by phase (includes fulfilled)
GET/analytics/commerce/overviewanalytics.yamlCommerce KPIs including fulfillment-adjacent metrics
interface FulfillmentDailySummary {
day: string; // Calendar day (ISO date, e.g. "2025-01-15")
total_fulfillments: number; // Total fulfillments processed
successful: number; // Successfully completed
failed: number; // Failed fulfillments
}
TableModuleRole
fulfillment_daily_summaryFulfillmentRead: aggregated daily metrics
order_headerOrderRead: source data with fulfillment status
fulfillmentFulfillmentRead: individual fulfillment records
ResourceTypePurpose
internalWorkerServes summary metrics via API
COMMERCE_TELEMETRYPipelineFulfillment event streaming to R2
Daily sync workflowCF WorkflowFeeds fulfillment data from Shopify
ActorRole
Staff user (Fulfillment)Reviews daily metrics and trends
Dashboard API WorkerServes summary metrics
PlanetScaleDatabase for fulfillment metrics
Daily syncFeeds fulfillment data from Shopify
  1. Daily sync workflow ingests orders with fulfillment status into order_header
  2. The mart refresh process aggregates fulfillment events by calendar day
  3. The summary table stores one metric row per day
  • Daily table — rows showing day, total fulfillments, successful count, failed count
  • Trend direction — most recent days appear first for quick anomaly detection
  • Simple read-only view — no filters or mutations; designed for at-a-glance monitoring

The current system queries fulfillment_daily_summary directly via the Supabase client. In the rewrite, this becomes an API endpoint that queries the equivalent table in PlanetScale.

The fulfillment summary may be implemented as either:

  • A dedicated mart table rebuilt by the hourly refresh workflow
  • A database view over order_header grouped by day and fulfillment status
  • Daily summary returns correct metrics matching raw fulfillment data
  • Results are sorted by day descending (most recent first)
  • Failed fulfillment count is accurate (derived from fulfillment event data)
  • Metrics refresh after each daily sync workflow completes