Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Vending Machine Fleet

Design a fleet service that tracks vending inventory, alerts operators, and routes desk orders to the nearest stocked machine. Audit a midnight maintenance batch without losing coverage or duplicating work orders.

Problem statement

Design a high-level system for a fleet of vending machines. A building may contain several machines. Operators need reliable low-stock and out-of-stock alerts, and a desk order should be assigned to the nearest machine that can fulfill the requested items.

Explain inventory ownership, order allocation, machine telemetry, restocking, APIs, storage, and failure recovery. State traffic, fleet-size, distance, payment, and fulfillment assumptions because the source does not supply them.

A separate reported starting design has 100,000 vending machines worldwide update a maintenance database at midnight, followed by a batch that creates work orders for restocking or technical failures. Audit that starting design while retaining the fleet, inventory, ordering and restocking capabilities above.

The report does not specify a time zone, update frequency within the night, event volume, urgency, batch coverage, retry policy or completion evidence.

For this exercise, compare a declared all-at-once UTC midnight window with a stated local-time policy; choose a bounded stagger/admission strategy and a separate path for urgent technical failures. Define a versioned expected machine/window roster, ordered durable evidence and an explicit coverage deadline.

Missing or late reports are unknown, rather than proof that a machine is healthy. Closed batch results must record their exact covered evidence and gaps, and reruns must not duplicate maintenance cases or work orders. A work-order creation or acknowledgement does not prove that physical repair or restocking occurred.

State urgency targets, lateness and retention bounds; preserve the existing scanned-quantity and post-restock audit requirements.

What to build

  1. Operators can register and monitor multiple vending machines within each building.
  2. The system tracks product quantity and machine health from vending-machine telemetry.
  3. Operators receive deduplicated low-stock and out-of-stock alerts for machine products.
  4. A desk order is assigned to the nearest eligible machine that can fulfill all requested items.
  5. The system reserves inventory for an assigned order and records fulfillment, expiry, cancellation, or failure without overselling.
  6. Audit the worldwide midnight maintenance starting plan, expose complete versus partial machine/window coverage, and idempotently derive restocking or technical-failure work from durable evidence without claiming that dispatched work proves physical recovery.

At scale

  • Source fact: one building may contain multiple vending machines, and desk orders should use the nearest machine with stock.
  • Source fact: operators need low-stock and out-of-stock alerts.
  • The original fleet source does not provide fleet size, order rate, telemetry interval, alert threshold or availability targets. The separate maintenance report supplies 100,000 worldwide machines and a midnight database update followed by work-order batching, but no rate, event count, time zone or urgency target. State all remaining operating assumptions.
  • The source does not specify payment, delivery ownership, product substitution, or the building-distance model; candidates should clarify or bound these concerns.
  • For this exercise, use 100,000 machines for the maintenance audit. All-at-once UTC midnight is a declared comparison scenario, not a reported time zone. Compare it with an explicit local-time policy and bounded jitter/admission; distinguish total events, peak arrival rate, database capacity, batch lag and coverage. Any numeric window, deadline or SLO you choose is a practice assumption.