KatInterview

Design a Freight Yard Platform for Dock Slots, Routes and Totes

System DesignModel answer
MediumModel answerSystem Designsystem-designevent-drivenscheduling

Last updated

Design a multi-warehouse platform that books dock doors, plans and replans truck routes, and tracks containers from noisy scan events while keeping inventory consistent.

Context

A retail logistics company runs a network of warehouses and wants one platform to coordinate trucks, dock doors and containers (totes or pallets). Containers move between dock doors, staging areas and storage, and travel between facilities on trucks.

People and devices that use the system:

  • Inbound trucks deliver containers to a warehouse.
  • Outbound trucks collect containers for other warehouses or last-mile hubs.
  • Floor operators scan containers at every physical hand-off, producing a heavy stream of events.
  • Dispatchers book door time slots, plan and replan routes, and watch container status and delays.

What the platform must do

  1. Loads: create and manage inbound and outbound loads, each with a container list and planned arrival or departure windows.
  2. Dock-door scheduling: assign trucks to doors and time slots, and detect and resolve conflicts.
  3. Route planning: given stops with time windows, produce a feasible stop sequence, and replan on delays, cancellations or missing containers.
  4. Container tracking: follow each container's location (facility and zone), lifecycle status (created, staged, loaded, in transit, received) and a summary of contents.
  5. Inventory correctness: never double-allocate a container or its inventory, and reconcile when scans conflict or arrive late or out of order.
  6. APIs and UI: dispatchers see routes, the door schedule and container status; operators submit scans.

Assumptions you may start from (change them and say so)

  • Tens to low hundreds of facilities, thousands of dock doors in total.
  • Hundreds to low thousands of scan events per second at peak, bursty per facility.
  • A route usually has up to about 15 stops, with many routes active at once.
  • Scan-to-visible latency in seconds; door-booking confirmation must be synchronous.
  • Networks can partition. Scanners buffer and replay, and a facility must keep scanning and serving last-known state while cut off.
  • Door scheduling and scan ingest target 99.9%+ availability; global analytics may be eventually consistent.
  • Multiple warehouses with role-based access (dispatcher, dock operator, viewer).

What to deliver

  • A high-level architecture: services, data stores, messaging.
  • A core data model.
  • Key APIs and events.
  • A consistency strategy: idempotency, ordering, deduplication.
  • A routing approach: exact or heuristic, and which objective you optimize.
  • An observability and failure-handling plan.

You may ask clarifying questions (for example whether an external transport system owns dispatch and ETAs, or whether another system owns SKU-level contents), but keep that pass short and spend most of your time on depth.

Hints

Hint 1

Spend a minute scoping: state an MVP and what is out of scope, then go deep on the hard parts (event correctness, door booking, routing) rather than reciting generic requirements.

Hint 2

Treat scans as an append-only event log keyed by a unique event ID and a per-container sequence or version, and derive current container state from it. Decide what to do with events that do not fit the current state.

Hint 3

For doors, prevent overlapping reservations with a transactional check per door (or per facility partition) so the consistency boundary is small. For routes, recognize a vehicle routing problem with time windows and choose a heuristic with local repair for replanning.