Design an Email Package Tracking Widget
Design low-overhead email extraction and a fresh, user-scoped active-shipment widget.
Problem statement
For this exercise, assume you are designing an inbox package-tracking widget. Incoming email may contain provider-neutral tracking references; extraction records confidence, deduplicates the same user and shipment across repeated messages, and must add little work to the durable email-ingestion path.
The widget shows only the authenticated user's active shipments and keeps their status fresh until a terminal delivered or failed state removes them from the active view.
Also assume 20,000 incoming messages per second, less than 10 milliseconds of added p99 ingestion work before durable handoff, 5 million active shipments, 100,000 widget reads per second with p95 below 100 milliseconds, and active status no more than 15 minutes stale under normal provider operation.
Raw message bodies are not retained beyond extraction needs. Exclude email delivery, carrier-specific customer support, and outbound notifications.
What to build
- Extract provider-neutral tracking references with confidence and idempotently associate each user with one logical shipment.
- Return the authenticated user's active shipments from a low-latency read model without exposing another user's message or shipment data.
- Refresh shipment status until a terminal delivered or failed state, then remove the shipment from the active view deterministically.
- Retry transient extraction and provider failures without duplicate shipments while enforcing bounded raw-message retention.
At scalePractice assumption
- 20,000 incoming messages per second and less than 10 milliseconds of added p99 ingestion work before durable handoff.
- 5 million active shipments and 100,000 widget reads per second with p95 below 100 milliseconds.
- Active status is no more than 15 minutes stale during normal provider operation, with explicit stale state during provider failure.