Airport Layover Activity Planning Service
Medium · System Design · Software Engineer · Technical Screen
Prompt
Design a mobile companion for air passengers waiting between connecting flights that suggests worthwhile ways to spend their stopover—grabbing food or coffee, browsing terminal shops, finding a quiet spot to rest or work, stretching their legs on an indoor walk, or visiting nearby attractions outside the airport when layover duration genuinely allows.
Intentional Open-Endedness (0 -> 1 Product & Architecture)
No preset latency SLA, traffic scale, ranking formula, feature boundary, or revenue model is provided up front. That ambiguity is deliberate: this design exercise evaluates whether you can partner with product stakeholders on an underspecified 0 -> 1 problem, ask high-leverage clarifying questions, propose and justify sensible engineering targets (such as low-hundreds-of-milliseconds P95 recommendation latency and roughly 1-minute flight-feed freshness), and prioritize a phased rollout rather than silently guessing or over-engineering infrastructure.
Above all, your design must enforce one critical asymmetric failure rule: recommending an activity that causes a passenger to miss boarding is a catastrophic, trust-destroying failure, whereas omitting a borderline venue costs almost nothing. Whenever flight schedules, gate assignments, or walking estimates are uncertain, the system must err conservatively.
Context Signals & Baseline Anchors
- Available Passenger Signals: Arrival airport and landing time, outbound departure and boarding timestamps (when published), inbound and outbound terminals/gates, and whether transit crosses security or border-control checkpoints.
- Pragmatic
v1Scope Defaults: Launch across a small set of major hub airports with verified indoor maps and merchant operating hours; restrict initial suggestions to the secure terminal zone while gating off-airport excursions behind multi-hour stopover thresholds in later releases.
Illustrative Scenario
Suppose a traveler lands at Denver (DEN) Gate A14 at 15:05 for a connecting flight (UA718) departing from Gate A38 at 16:20, with boarding scheduled for 15:40. Although 16:20 - 15:05 looks like 75 minutes on paper, anchoring on the 15:40 boarding cutoff, subtracting a 10-minute safety cushion, and applying conservative p90 walking durations leaves 15 usable minutes at a nearby espresso counter (leave_by = 15:24), eliminates a 40-minute sit-down restaurant in the same concourse, and immediately rules out any option that exits the secure perimeter.
Scope & Expectations
- Ambiguity Resolution & Scoping: Surface the product questions that materially reshape the architecture (traveler personas, secure-zone vs. city excursions, itinerary ingestion, hub coverage, and monetization) and commit to explicit
v1defaults and non-functional targets. - Conservative Feasibility Modeling: Formulate a per-venue
leave-bycalculation and hard safety filter that account for boarding cutoffs, conservative travel percentiles, checkpoint crossings, and missing or stale data. - End-to-End Mobile & Backend Design: Cover flight-status ingestion, directed indoor terminal routing, transparent candidate ranking, live flight-change replanning, and offline-capable reminders on unreliable airport networks.
- Trust Guardrails & Evolution: Address stale merchant hours, sponsored placement isolation, near-miss telemetry circuit breakers, and a disciplined
v1 -> v3roadmap.
Step-by-step walkthrough
Handle ambiguity first and lock in v1 assumptions
The prompt deliberately leaves out latency targets, traffic scale, airport coverage, and monetization. Jumping straight to server boxes by guessing silently misses what this interview tests: whether you can take an underspecified
0 -> 1product, surface the decisions that change the architecture, and pick a safe starting point.Spend the first three minutes running a clear ambiguity playbook:
- Ask the 5–6 questions that materially alter the system, stating why each answer changes the design.
- Propose sensible defaults whenever the interviewer says "you decide," and write them down explicitly so the interviewer can swap any assumption later.
- Anchor every decision on the core failure asymmetry: recommending a café that makes someone miss their flight is a catastrophic, trust-destroying failure, whereas failing to show one extra café costs almost nothing. Whenever data is missing, stale, or uncertain, the system must err on the conservative side.
Clarifying question Why it changes the design Proposed v1 default Who is the target traveler? Families with strollers or travelers with reduced mobility walk slower and need elevators; solo business travelers want quiet seating and power outlets. General travelers, with a mobility/kids toggle (slower walking speed + step-free paths only) and an intent filter ( eat,rest,work,shop,walk).Strictly inside the terminal, or outside too? Leaving airside (the secure zone past security checkpoints) for landside (the public terminal or city outside security) adds TSA/security re-entry, immigration, visas, and road traffic. Airside only in v1. Leaving the airport is deferred to v3 behind a strict multi-hour layover gate. How do we get the itinerary? A mistyped departure time is more dangerous than having no app at all. Scan the boarding-pass barcode (which encodes carrier, flight number, and date) or enter the flight number manually, then always fetch live times and gates from an authoritative flight-status feed. Which airports are in v1? Safe recommendations require verified indoor walking graphs, checkpoint locations, and opening hours. 5–10 major connecting hubs where we have verified terminal maps and merchant hours. Uncovered airports show a time budget only, never guessed places. What is the business model? Paid placements create immediate tension with traveler safety and trust. v1 optimizes purely for traveler trust and retention (zero ads). v2 adds order-ahead food and lounge passes, plus strictly gated sponsorships. Informational or transactional? In-app payments and kitchen integrations add major scope, though pre-ordering also eliminates line-wait uncertainty. Informational + indoor turn-by-turn navigation in v1; order-ahead pickup in v2. Functional scope and proposed non-functional targets
Functional requirements (v1)
- Ingest the traveler's inbound and outbound flights, resolve arrival and departure terminals/gates, and identify whether any security or immigration checkpoints sit along the transfer route.
- Return a short ranked list of activities the traveler can safely finish, showing a place-specific leave-by time on every card (for example,
"Leave by 15:24 — 6 min walk to Gate A38"). - Filter by current intent (
eat,coffee,rest,work,shop,walk,kids) and practical needs (power_outlets,quiet,step_free). - Guide the traveler to the chosen spot and fire reliable "head to your gate" reminders.
- Monitor live flight updates (delays, gate swaps, earlier boarding) and re-plan active layovers automatically.
- Let travelers submit one-tap ground-truth reports (
"Place is closed","Walk took longer").
Proposed non-functional targets (and why each value fits the product)
Here P95 (95th percentile) means 95 out of 100 requests finish within that time.
Metric Proposed target Justification Recommendation API latency P95 <= 300 ms (server-side) Travelers check the app while walking through a concourse; the mobile client also renders its cached plan immediately. Flight-status freshness P95 <= 60 s from provider update to our database Gates and boarding times shift rapidly; 5–10 minutes of stale data would silently eat a short layover's safety cushion. Urgent re-plan alert P95 <= 60 s from flight change to push dispatch An earlier departure or terminal swap must reach the traveler while they still have time to walk back. Leave-by alarm reliability Works 100% offline Terminal Wi-Fi and cellular reception are spotty, and mobile push notifications can be delayed; alarms must be scheduled locally on the phone. API availability 99.9% (~8.7 hours/year downtime budget) Paired with an offline on-device airport pack so active travelers still see their countdown and map during a server outage. Product safety >= 99.5% of followed plans reach the gate with >= 5 min before the gate deadline Our primary safety guardrail, measured continuously via opt-in arrival telemetry. Back-of-the-envelope sizing
Estimating traffic and data sizes early tells us whether this is a massive distributed throughput problem or a data-correctness and client-resilience problem:
Traffic assumptions (v1 = 8 major hub airports) Connecting passengers per hub ~40,000 / day Total layovers in v1 hubs 8 x 40,000 = 320,000 / day App active layovers (~15% adoption) ~50,000 layovers / day Recommendation API load API calls per active layover ~15 (open app, filter, select plan, refresh) Daily requests 50,000 x 15 = 750,000 / day -> ~9 req/s average Peak (airline connection waves) 10x average -> ~90 req/s peak Live flight-status updates Departures across 8 hubs 8 x 1,000 = 8,000 flights / day (~3,000 active at once) If polling every 60 s 3,000 / 60 = 50 outbound calls/s to flight provider With provider webhooks (push) ~10 updates/flight/day -> 80,000 events/day (~1 event/s) Airport catalog & indoor travel-time data Points of interest (POIs) ~300 per hub x 8 hubs = 2,400 POIs x 2 KB = ~4.8 MB total Graph nodes per hub ~200 gates + ~300 POIs + ~100 junctions/checkpoints = ~600 nodes Precomputed travel-time matrix 600 x 600 = 360,000 pairs x 3 values (p50, p90, step-free p90) x 2 bytes (uint16 seconds) = ~2.2 MB per airport (~500 KB compressed) Opt-in location telemetry (only while an activity plan is active) Samples per active layover ~60 pings -> 3,000,000 events/day (~35 writes/s)Two architectural conclusions jump right out of this math:
- Server throughput is tiny. Peak load of ~90 req/s and ~35 telemetry writes/s easily runs on 2–3 small stateless API servers (for redundancy) and a single primary PostgreSQL database with a replica. Do not waste interview time sharding databases.
- An entire airport fits in ~2–3 MB. The mobile app can download a versioned airport pack (POIs, hours, and the precomputed
600 x 600walking-time table) over Wi-Fi or cellular in a second, enabling offline feasibility checks and offline alarms.
Core abstraction: per-place leave-by time and the hard feasibility gate
Travelers do not actually ask "What restaurants exist at Denver International?" Their real question is "What can I do right now and still stand at my departure gate calmly before boarding?"
Why "time until departure" is the wrong number. If it is
15:05and your connecting flight departs at16:20, subtracting timestamps suggests75 minutesof free time. In reality:- Airlines close the aircraft door 15–20 minutes before departure, and boarding starts 35–50 minutes before departure. Targeting boarding start (
gate_deadline) gives a calm experience and builds a natural cushion before the door actually closes. - Every candidate place
phas a different walk time there (go(p)) and a different walk time frompto your departure gate (back(p)), plus any security checkpoint waits along those routes. - Using average (p50 / median) walk times means half of all trips take longer than planned. We plan with p90 times (90th percentile: long enough to cover 9 out of 10 travelers, including crowded concourses).
Every candidate place
pis evaluated against its own leave-by time:Timeline for one candidate place p: now arrive at p leave_by(p) gate_deadline est_dep |--- go(p) --->|==== minutes_on_site ====|--- back(p) --->|<-- buffer -->| | 15:05 15:09 15:24 15:30 15:40 16:20 Formulas (all travel times include p90 walking + p90 checkpoint/train waits along the path): gate_deadline = published_boarding_time else (est_dep - airline_boarding_lead) # default 40-45 min leave_by(p) = gate_deadline - buffer - back_p90(p) stay_from(p) = max(now + go_p90(p), opens_at(p)) stay_until(p) = min(leave_by(p), closes_at(p)) minutes_on_site(p) = max(0, stay_until(p) - stay_from(p)) is_feasible(p) = minutes_on_site(p) >= min_dwell(p) and path(now -> p -> gate) adds zero extra security screeningsNotice how opening hours interact cleanly with
leave_by(p): if a lounge closes at15:00andleave_by(p)is16:30,stay_until(p)becomes15:00— the traveler still gets a valid recommendation ifminutes_on_siteexceedsmin_dwell(for example,10 minfor grab-and-go coffee,30 minfor a lounge,45 minfor sit-down dining).def compute_leave_by(gate_deadline_min: int, buffer_min: int, back_p90_min: int) -> int: """Latest minute the traveler can walk out of place p and reach the gate safely.""" return gate_deadline_min - buffer_min - back_p90_min def compute_minutes_on_site( now_min: int, gate_deadline_min: int, buffer_min: int, go_p90_min: int, back_p90_min: int, opens_at_min: int, closes_at_min: int, ) -> int: """Usable stay duration at place p, clipped to opening hours and leave-by deadline.""" # Traveler can start using the place only after arriving AND after it opens stay_from = max(now_min + go_p90_min, opens_at_min) # Traveler must stop at whichever comes first: leave-by time or closing time leave_by = compute_leave_by(gate_deadline_min, buffer_min, back_p90_min) stay_until = min(leave_by, closes_at_min) return max(0, stay_until - stay_from) def is_feasible( now_min: int, gate_deadline_min: int, buffer_min: int, go_p90_min: int, back_p90_min: int, min_dwell_min: int, opens_at_min: int, closes_at_min: int, adds_extra_checkpoint: bool, ) -> bool: """Hard safety gate: returns True only if the activity fits safely without extra screening.""" if adds_extra_checkpoint: return False usable_min = compute_minutes_on_site( now_min, gate_deadline_min, buffer_min, go_p90_min, back_p90_min, opens_at_min, closes_at_min ) return usable_min >= min_dwell_minUncertainty only shrinks the budget, never expands it. We start with a
10 minbase buffer and add explicit penalties whenever data is missing or stale:Missing or uncertain signal Conservative adjustment Outbound gate not assigned yet Set back_p90(p)to the slowest gate in the departure terminal (or across all airside terminals if terminal is unknown).Airline has not published boarding time Estimate est_dep - default_boarding_leadand add+5 mintobuffer.Flight status feed older than 5 minutes Add +5 mintobufferand display"Flight info 6m old"in the UI.Flight data sources disagree Use the earliest credible departure/boarding timestamp. Mobility / kids mode enabled Switch go_p90andback_p90tostep_free_p90(elevators + slower walking speed).Why feasibility is a hard gate, NOT a ranking feature. If time slack were just one weighted term inside a recommendation score (
score = 0.6 * rating + 0.4 * slack), a 4.9-star steakhouse with-8 minutesof slack could outrank a safe 4.2-star café. Putting a hard boolean filter before the ranker guarantees that neither star ratings, machine-learning weights, nor merchant ad dollars can ever surface an unsafe option. And ifgate_deadline - buffer - back_p90(current_pos) - now < 15 min, the app skips activity cards altogether and renders a full-screen "Go straight to Gate A38" view showing only restrooms and grab-and-go kiosks directly along that corridor.- Airlines close the aircraft door 15–20 minutes before departure, and boarding starts 35–50 minutes before departure. Targeting boarding start (
API design
POST /v1/layovers Headers Idempotency-Key: <client-UUID> Body {"boarding_pass_barcode": "..."} OR {"outbound_flight": "UA718", "date": "2026-11-30"} 201 {"layover_id": "lay_9f2", "airport": "DEN", "coverage": "FULL" | "BUDGET_ONLY", "outbound": {"flight": "UA718", "status": "ON_TIME", "est_dep": "2026-11-30T16:20:00Z", "boarding_est": "2026-11-30T15:40:00Z", "terminal": "A", "gate": "A38", "gate_known": true, "data_age_s": 32}, "required_checkpoints": [], "gate_deadline": "2026-11-30T15:40:00Z", "deadline_basis": "PUBLISHED_BOARDING"} GET /v1/layovers/{id}/recommendations?from_node=gate_A14&intent=coffee&needs=power,step_free&limit=5 200 {"plan_version": 4, "flight_data_age_s": 32, "time_budget_only": false, "items": [{"poi_id": "den_a_coffee_07", "name": "Blue Sky Espresso", "category": "coffee", "go_p90_min": 4, "back_p90_min": 6, "minutes_on_site": 15, "leave_by": "2026-11-30T15:24:00Z", "confidence": "HIGH", "why": ["4 min walk", "Open until 21:00", "Power outlets"], "sponsored": false}]} POST /v1/layovers/{id}/plan {"poi_id": "den_a_coffee_07"} 200 {"plan_version": 5, "leave_by": "2026-11-30T15:24:00Z", "local_alarms": ["2026-11-30T15:19:00Z", "2026-11-30T15:24:00Z"]} POST /v1/layovers/{id}/events {"type": "LEFT_POI" | "ARRIVED_AT_GATE" | "REPORT_CLOSED", "at": "..."} GET /v1/airports/{code}/pack?since_version=18 -> binary/JSON diff of POIs, hours, and travel_matrix Push payload (APNs / FCM) {"type": "REPLAN" | "LEAVE_NOW", "layover_id": "lay_9f2", "plan_version": 6}Here an idempotency key is a client-generated unique token per action so retrying a timed-out network request returns the existing layover record instead of creating a duplicate. Push payloads carry only
plan_versionrather than raw times: if two pushes arrive out of order, the phone checksif push.plan_version > local_versionand fetches the latest truth.Data model and the directed airport walking graph
Straight-line GPS distance fails inside airports: two gates
80 metersapart on a map may sit in disconnected concourses separated by a30-minutesecurity line, and crossing from airside to landside is one-way (walking out through the exit doors takes1 minute, while walking back in requires clearing TSA security). We therefore model each airport as a directed graph:[Concourse A Airside] [Public Terminal Landside] (Gate A14) <--4m--> (Espresso 07) --1m exit--> (Baggage / Landside Diner) | | | 7m 6m 25m p90 TSA security wait v v | (Gate A38: Departure) <-------------------------------+In this directed graph,
Gate A14 -> Landside Diner -> Gate A38adds a25-minutesecurity checkpoint thatGate A14 -> Gate A38did not need, soadds_extra_checkpoint = Trueimmediately disqualifiesLandside Diner. Conversely, if an arriving international passenger starts landside after customs and must clear TSA security to reachGate A38anyway,go_p90(Espresso 07)automatically includes that25-minutesecurity wait sominutes_on_siteis never overestimated.PostgreSQL tables (single primary + read replica; airport catalog exported as versioned packs) airports (code PK, name, tz, coverage_state, pack_version) zones (zone_id PK, airport, terminal, side [AIRSIDE|LANDSIDE], is_international) nodes (node_id PK, airport, zone_id, kind [GATE|POI|CHECKPOINT|JUNCTION], level, x, y) edges (from_node, to_node, walk_p50_s, walk_p90_s, is_step_free, exits_airside) checkpoints (node_id PK, kind [SECURITY|IMMIGRATION|TRAIN], hourly_wait_p50_s[168], hourly_wait_p90_s[168]) travel_matrix (airport, hour_bucket, from_node, to_node, p50_s, p90_s, step_free_p90_s, checkpoint_count) pois (poi_id PK, airport, node_id, category, name, min_dwell_min, rating, review_count, tags[], hours_json, hours_verified_at, confidence [HIGH|LOW], is_active) flights (flight_key PK [carrier, number, date], sched_dep, est_dep, boarding_est, terminal, gate, status, provider_updated_at, received_at) layovers (layover_id PK, user_id, airport, inbound_key, outbound_key, mobility_mode, active_poi_id, leave_by, plan_version, state) telemetry (event_id, layover_id, event_type, node_id, predicted_s, observed_s, recorded_at)High-level architecture
+----------------------------------- Mobile Client -----------------------------------+ | Boarding-pass scanner · Downloaded Airport Pack (POIs + p90 travel_matrix) | | On-device feasibility verifier · Local OS Alarms (fires with zero Wi-Fi/cellular) | +-------------------+-------------------------------------------------+---------------+ | HTTPS REST ^ Push (plan_version) v | +-------------------+ +---------+-----------+ | API Gateway | | Notification Svc | +----+---------+----+ | (APNs / FCM) | | | +---------+-----------+ +--------+ +-------------+ ^ v v | +---------------+ +------------------------+ +---------+-----------+ | Layover Svc | | Recommendation Svc | | Re-plan Worker | | - itinerary | | 1. Zone/intent filter |<----| Recomputes deadline | | - deadline | | 2. Hard feasibility | | & leave_by on any | | - active plan | | 3. Transparent ranker | | flight/gate change | +-------+-------+ +-----------+------------+ +---------+-----------+ | | in-memory ^ flight_changed | +---------v------------+ +---------+-----------+ | | Airport Pack Store | | Flight Ingestion |<-- Webhooks + | | (versioned graphs) | | & Conservative Merge| 60s poll | +---------^------------+ +---------------------+ fallback v | +----------------------------------------+--------------------------------------------+ | PostgreSQL (flights, layovers, catalog) Telemetry Stream --> Warehouse --> Nightly| | p90 Walk & Queue Calibration Pipeline | +-------------------------------------------------------------------------------------+- Recommendation path: The app snaps the user's indoor position (Apple/Google indoor positioning, Bluetooth beacons, or "I am near Gate A14") to
from_nodeand callsGET /recommendations. The Recommendation Service keeps all 8 airport packs in RAM (~23 MB total), checks every matching POI againsttravel_matrixin under2 ms, discards infeasible options, ranks the survivors, and returns the top 5 with individualleave_bytimestamps. - Flight-change path: Flight Ingestion receives a webhook (or 60-second fallback poll), updates
flights, and emitsflight_changedwheneverest_dep,boarding_est,terminal, orgatemoves. The Re-plan Worker queries active layovers indexed byoutbound_key, recomputesleave_by, bumpsplan_version, and triggers a push if the traveler needs to know.
- Recommendation path: The app snaps the user's indoor position (Apple/Google indoor positioning, Bluetooth beacons, or "I am near Gate A14") to
Deep dive: live flight updates, conservative source merging, and offline alarms
Merging conflicting flight feeds safely. Commercial aggregators (like Cirium or FlightAware) and airline feeds often disagree by several minutes. Instead of "most recent update wins," we merge asymmetrically for safety:
- Departure and boarding times: take the earliest credible timestamp across non-stale feeds. Sending a traveler to the gate 8 minutes early is harmless; 8 minutes late can mean a closed door.
- Gate changes: apply immediately from any trusted feed, because walking to the wrong concourse wastes precious buffer.
- Delays are treated as "unconfirmed" at first! Airlines frequently post a 90-minute rolling delay due to crew or equipment swaps and then swap in a spare aircraft, pulling departure back 60 minutes earlier. When a delay arrives:
- We show
"Delayed — new est. boarding 17:10"and surface nearby airside options right away. - We keep an intermediate "check flight status" reminder near the original
leave_bywindow and block long-commitment activities far from the gate until the airline publishes a confirmed boarding time or the delay holds steady for 15 minutes.
- We show
Why push notifications cannot be the alarm clock. APNs (Apple Push Notification service) and FCM (Firebase Cloud Messaging) are best-effort channels: inside concrete terminal basements or captive-portal Wi-Fi, pushes can arrive 15 minutes late or drop completely. Therefore:
- Selecting a plan schedules two local OS notifications directly on the device (
5 min warningandLeave now), which fire from the phone's hardware clock with Airplane Mode on. - On Android 12+, OS battery-saving ("Doze" mode) can defer standard alarms by several minutes unless the user grants the exact-alarm permission; if declined, the app shifts the local alarm
5 minutesearlier to absorb Doze jitter. - If the app has not reached our server for
> 10 minutes, it displays an"Offline mode"banner and computesleave_byusingmin(scheduled_departure, last_known_estimate)— never reverting blindly toscheduled_departurein case an earlier boarding time was already received.
Deep dive: rule-based ranking, data quality, and trust traps
You do not need machine learning in v1. Once the hard feasibility gate filters 300 airport POIs down to 10–35 safe candidates, a transparent, explainable linear formula ships on day one with zero cold-start data:
score(p) = 3.0 * intent_match(p) # 1.0 if category matches user's filter, else 0.0 + 1.0 * bayesian_rating(p) # star rating pulled toward airport average when review_count is tiny + 1.0 * min(2.0, minutes_on_site(p) / min_dwell(p)) # rewards unhurried slack, capped at 2x - 0.5 * (go_p90_min(p) / 10.0) # closer walk wins (inverted when intent == "walk") + 0.5 * matched_needs_ratio(p) # power outlets, quiet seating, step-freeHere Bayesian rating shrinkage means blending a shop's raw rating with the airport-wide average (
(reviews * rating + 10 * airport_avg) / (reviews + 10)) so a brand-new kiosk with a single 5-star review does not outrank a proven 4.7-star café with 300 reviews. After scoring, a diversity pass caps any single category at 2 of the top 5 slots and attaches plain-English"why"badges ("4 min walk · Outlets · 15 min to relax").Handling messy airport data and defending narrow coverage:
- Stale or uncertain opening hours: Airport shops change hours seasonally. Any POI whose hours were not verified within 60 days gets
confidence = LOW, shows"Hours unconfirmed", ranks below allHIGH-confidence options, and is hidden completely when the traveler has< 35 minutes(no time to walk to a shuttered café and recover). Two user"Closed"taps within an hour auto-suppress the POI immediately and alert ops. - Defending narrow v1 coverage: Covering 8 verified hubs deeply and returning
time_budget_only: true("You have ~45 safe minutes before boarding at Gate C14") at the other 500 airports beats scraping unverified web maps everywhere. One viral story of sending a traveler across security to a permanently closed restaurant kills retention faster than saying "We don't map this terminal yet." - Six classic layover trust traps to call out explicitly:
- Using
departure_time - nowinstead of per-placeleave_by(p)anchored to boarding start. - Recommending a landside or disconnected-terminal spot that forces an unbudgeted security screening.
- Planning with median (
p50) walk times instead ofp90+ uncertainty buffers. - Letting ad spend or star ratings trade off against timing feasibility.
- Trusting an initial flight delay immediately and letting the traveler wander 30 minutes away.
- Relying on server push notifications instead of local on-device alarms.
- Using
- Stale or uncertain opening hours: Airport shops change hours seasonally. Any POI whose hours were not verified within 60 days gets
Failure modes, safety telemetry, and v1-to-v3 roadmap
Failure scenario Graceful degradation Primary flight-status provider outage Switch to secondary provider / 60s polling; as data_age_spasses 5 min, staleness buffer automatically subtracts 5 min fromleave_byand warns the user.Backend API unreachable Mobile app runs is_feasiblelocally against its cached airport pack + last known flight deadline, clearly labeled with data age.Bad airport pack pushed (broken graph edge) Pre-publish CI validates that every gate connects to airside POIs; packs carry pack_versionfor instant one-click rollback.User ignores first leave-by alarm Escalate to a persistent "Leave now — boarding in 17 min"lock-screen alert and switch the UI to direct gate navigation.Safety monitoring and product evolution:
- North-star metric: Safe engaged layovers — layovers where the traveler started an activity and arrived at their departure gate with
>= 5 minutesbeforegate_deadline. - Automated safety circuit breaker: Telemetry compares predicted
back_p90against observed walk-back durations (ARRIVED_AT_GATE - LEFT_POI). If any hub's near-miss rate (gate arrival margin< 5 min) exceeds0.5%, an automated job immediately raises that hub's base buffer by+5 minand pages the on-call engineer. - Phased roadmap:
- v1: 8 hubs, airside only, rule-based ranking, offline packs and local alarms.
- v2: Telemetry-calibrated
p90walking/checkpoint models, order-ahead food pickup (replaces variable queue wait with a fixed pickup timestamp!), and strictly gated sponsored slots. - v3: Leaving the airport on
>= 5–6 hourlayovers, adding customs, transit trafficp90, visa confirmation, and security re-entry into the feasibility chain.
- North-star metric: Safe engaged layovers — layovers where the traveler started an activity and arrived at their departure gate with
Intuition & how it works
Think of a layover app not as "Yelp inside an airport," but as a protective personal assistant standing at your departure gate with a stopwatch. Before suggesting any coffee shop, lounge, or quiet workspace, the assistant starts from the moment your plane begins boarding, subtracts a conservative walk-back time and a safety cushion, and computes the exact minute you would need to stand up and leave that specific spot. Any activity that cannot comfortably fit inside that remaining window is thrown away before ranking even starts.
A naive design takes departure_time - current_time (say, 75 minutes), searches for nearby shops using straight-line GPS coordinates, and sorts them by star rating. That fails dangerously in airports for four reasons: aircraft doors close 15–20 minutes before scheduled departure, two gates 100 meters apart on a map can be separated by a one-way exit and a 30-minute security line, average walk times are exceeded on half of all trips, and sorting by a combined score lets a 4.9-star restaurant outweigh the risk of missing a flight.
Walk through a concrete 75-minute layover at Denver (DEN): a passenger lands at Gate A14 at 15:05 for connecting flight UA718 departing from Gate A38 (same secure concourse) at 16:20:
- Compute the gate deadline: Boarding starts at
15:40(gate_deadline = 15:40), with a10 minsafety buffer, so the traveler must arrive back at Gate A38 by15:30. - Check Candidate A (Blue Sky Espresso,
min_dwell = 10 min): Conservative p90 walk (90th percentile, meaning 9 out of 10 travelers walk it this fast or faster) isgo = 4 min(arrive 15:09) andback = 6 min(leave_by = 15:30 - 6 = 15:24). Usable time on site is15:24 - 15:09 = 15 min >= 10 min-> PASSES (shown with"Leave by 15:24"). - Check Candidate B (Concourse Chophouse, 4.9 stars,
min_dwell = 40 min):go = 5 min(arrive 15:10),back = 7 min(leave_by = 15:23). Usable time is13 min < 40 min-> REJECTED by the hard gate, despite its 4.9-star rating. - Check Candidate C (Landside Burger Counter,
min_dwell = 15 min): Exiting the secure airside zone to the public landside zone forces a25 minp90 TSA re-screening on the return path -> REJECTED immediately because it adds an unnecessary security checkpoint.
Key trade-offs
- Clarifying ambiguity and scoping a narrow v1 vs. building everything at launch. Starting with 5–10 verified hub airports, airside-only places, and informational navigation limits initial addressable users, but eliminates the unverified map data and immigration edge cases that would cause missed flights early on. Stating explicit defaults up front also gives the interviewer clear levers to adjust during the conversation.
- Hard boolean feasibility gate vs. weighted risk score. Filtering candidates strictly (
minutes_on_site >= min_dwelland zero added checkpoints) before ranking can leave very short lists on tight layovers. In return, no rating weight, machine-learning bug, or merchant sponsorship can ever trade traveler safety for engagement, and safety becomes a unit-testable invariant. - p90 travel times + dynamic uncertainty buffers vs. average (p50) estimates. Planning with p50 (the median, exceeded 50% of the time) maximizes how many activities appear, whereas p90 plus extra buffer for unknown gates or stale flight feeds trims marginal options. Because a missed flight is vastly costlier than 10 spare minutes at the gate, conservative percentiles are mandatory.
- Asymmetric multi-source flight merging vs. "latest timestamp wins." Taking the earliest credible boarding/departure time across feeds and holding back risky recommendations until a flight delay stabilizes occasionally brings travelers to the gate early when a delay turns out to be real, but protects them when airlines swap aircraft and pull a delayed flight back earlier.
- Downloaded on-device airport packs and local OS alarms vs. thin server-only client. Shipping a ~2–3 MB versioned airport pack (POIs + precomputed walking-time matrix) and scheduling local phone alarms duplicates feasibility logic on mobile, but guarantees "leave now" reminders fire even when terminal Wi-Fi drops or APNs/FCM (Apple and Google push services) delay notifications.
- Explainable rule-based ranking vs. machine learning in v1. A simple weighted formula with Bayesian shrinkage (pulling ratings with very few reviews toward the airport average) needs zero historical click data and lets us display clear
"why"badges; learned personalization can follow in v2 strictly downstream of the feasibility gate.
Common mistakes
- Jumping into microservice diagrams without resolving product ambiguity, never asking about target travelers, airside vs. landside scope, or proposed latency/freshness targets.
- Using
departure_time - nowas a single global free-time number, ignoring boarding cutoffs, per-POI walk-back times, and security checkpoints. - Modeling indoor terminals with straight-line GPS coordinates instead of a directed walking graph that respects floors, trains, and one-way security exits.
- Putting flight-miss risk inside the ranking score, allowing high ratings or sponsored bids to surface options with negative slack.
- Trusting a newly announced flight delay immediately, letting travelers start a 60-minute meal far away just before the airline swaps equipment and boards on time.
- Relying solely on server push notifications for "time to head back" alerts despite captive-portal airport Wi-Fi and Android battery-saving delays.
- Obsessing over database sharding for ~90 peak requests/second while ignoring stale merchant opening hours and uncalibrated walk-time estimates.
Follow-up questions
- Suppose an outbound flight posts a 90-minute delay while a traveler is already midway through an activity. How do you ingest that update and safely revise their active plan in real time? Flight Ingestion receives the airline/aggregator webhook (or 60-second fallback poll), updates the
flightstable, and publishes aflight_changedevent; the Re-plan Worker looks up active layovers via theoutbound_keyindex, recalculatesgate_deadline, incrementsplan_version, and sends a lightweight push so the app refreshes. Because airlines frequently pull rolling delays back earlier when a spare aircraft arrives, the app immediately shows"Flight delayed — extended stay est. until 16:54"and unlocks nearby airside options, but keeps a soft "re-check flight" local alarm at the originalleave_bytime until the airline posts a confirmed new boarding time or the delay holds steady for 15 minutes. High-commitment activities far from the gate (and leaving the airport) stay locked while a delay is unconfirmed, and if the airline pulls departure earlier again, an urgent push plus rescheduled local alarms immediately shortenleave_by. - If indoor transit estimates turn out too optimistic and travelers start reporting close calls at boarding, how do you catch that pattern in telemetry and adjust your timing model? For consented active plans, the app logs predicted
back_p90alongside observed transit duration (ARRIVED_AT_GATE - LEFT_POIvia indoor beacons/geofences or user taps) and arrival margin (gate_deadline - ARRIVED_AT_GATE). By definition, a well-calibratedp90estimate should be exceeded on only ~10% of walks, so an exceedance rate spiking to 25%+ or arrival margins under 5 minutes rising above 0.5% triggers an automated alert sliced by airport, concourse edge, checkpoint, hour of day, and mobility profile. We respond at two speeds: immediately trip an automated circuit breaker that adds+5 to +10 minutesto that airport's or corridor's base buffer, then re-estimate graph edgep90weights from observed telemetry while accounting for missing segments (elevator/tram waits, food-pickup lines, wayfinding confusion) and selection bias (rushing travelers walk faster than relaxed ones). - Airport merchants want to sponsor top spots. How do you structure ranking so paid boosts never surface risky or mismatched venues, and how do you prove to leadership that traveler trust stays intact? Enforce strict stage isolation: candidate generation -> hard feasibility gate -> relevance & quality floor (matches user's selected intent,
confidence == HIGHopen hours, minimum rating threshold) -> sponsored promotion (either filling at most 1 clearly badged"Sponsored"slot bybid x relevance_scoreor boosting an already-eligible item by at mostK = 2positions). Because sponsored logic runs strictly after the gate and relevance floor — verified by an automated invariant test asserting the sponsored stage can only permute survivors, never inject new IDs — money can never surface an unsafe or off-intent shop. To prove trust holds to leadership, maintain a permanent 5% user-level holdout that sees zero sponsorships and track guardrails: near-miss rate (must stay identical),"not relevant"/"closed"feedback rate, post-visit ratings on sponsored vs. organic picks, plan-start conversion, and 30-day repeat-traveler retention. - On an extended international transfer where visiting the city requires clearing immigration, customs, and security re-entry, how do your time-budget math and excursion gates change compared to a short domestic hop? On a short domestic connection, the traveler stays airside and
back_p90(p)is simply indoor walking (plus at most an inter-terminal shuttle). Leaving the airport on an international layover turns the timeline into a multi-stage p90 chain:exit_immigration_p90 + customs_and_bag_storage_p90 + outbound_transit_p90 + activity_dwell + return_transit_p90 (with road-traffic variance) + bag_drop_cutoff + security_reentry_p90 + walk_to_gate_p90 + larger_buffer (30–45 min), because a highway jam offers zero quick recovery. We guard "leave the airport" behind a dedicated gate: unlock it only when usable city dwell time after all p90 overheads exceeds ~90–120 minutes, only on scheduled (never unconfirmed-delay) hours, and only after an explicit checklist confirming visa/transit-entry eligibility and checked-baggage status, displaying a prominent "Must board return transit by HH:MM" point-of-no-return alarm.
Follow-up questions
- Suppose an outbound flight posts a 90-minute delay while a traveler is already midway through an activity. How do you ingest that update and safely revise their active plan in real time?
- If indoor transit estimates turn out too optimistic and travelers start reporting close calls at boarding, how do you catch that pattern in telemetry and adjust your timing model?
- Airport merchants want to sponsor top spots. How do you structure ranking so paid boosts never surface risky or mismatched venues, and how do you prove to leadership that traveler trust stays intact?
- On an extended international transfer where visiting the city requires clearing immigration, customs, and security re-entry, how do your time-budget math and excursion gates change compared to a short domestic hop?
Similar questions
- Global Live Video Streaming Platform
- Multi-User Collaborative Document Editor
- Burst-Resilient Multi-Channel Notification Platform
- Prior Authorization Status Engine, Clinical Worklists, and Digests
- Diagnosing and Optimizing Full-Stack Web Request Latency
- Multi-Source Enterprise Question Answering System