Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Live Location Tracking Service

Ingest live locations and serve fresh tracks only to authorized viewers, within each share's time and place limits, with bounded history and honest staleness.

Problem statement

Design a live tracking service for moving objects such as people sharing their location with chosen contacts, deliveries, or field agents. For this exercise, assume a tracker, such as a person's phone, publishes sequenced GPS updates and authorized viewers subscribe to one track or query its recent history.

For this exercise, also assume the owner can limit each share in time, either with an end time or duration or with a repeating weekly schedule in the owner's time zone, and by place, with private places such as home defined as circles where sharing pauses and positions recorded inside never appear in history.

The service must reject unauthorized access and enforce these share rules on the server for every live delivery, history read, and reconnect, so no viewer gets a position outside its allowed time or inside a private place, even from a cache or an old cursor.

It must also prevent out-of-order updates from regressing the visible position, label stale tracks, and tolerate reconnect/replay. Cover ingestion, latest state, fan-out, history, geospatial access, privacy, backpressure, and recovery. Route optimization and the tracker hardware are outside scope.

What to build

  1. Accept authenticated sequenced location updates idempotently.
  2. Stream authorized latest positions with freshness and connection state, and show a paused or outside-window state with no position when a share rule blocks the viewer.
  3. Return a bounded recent track history with documented sampling and retention, including only positions inside the viewer's allowed time windows and outside the owner's private places.
  4. Enforce track-scoped authorization, the share's allowed time, private-place exclusion, and auditable revocation for every read or subscription.
  5. Let the owner create, update, and end a share with a time limit or weekly schedule, and define or remove private places; each change gets a new rule version.

At scale

  • For this exercise, assume one million active trackers, such as sharing phones, publishing every five seconds and up to twenty concurrent viewers for a hot track.
  • For this exercise, deliver healthy updates to subscribed viewers within two seconds at p95 and label a track stale after 30 seconds without accepted data.
  • For this exercise, retain detailed history for seven days and downsampled history for ninety days.
  • For this exercise, accepted updates must survive a zone failure, while disconnected viewers may resume from a bounded cursor instead of receiving an unbounded backlog.