Time-Aware Airport Activity Recommender System
System DesignModel answerLast updated
Design a real-time system that suggests safe activities during airport layovers while guaranteeing travelers never miss their connecting flights.
You're building a service that helps travelers make productive use of downtime between connecting flights. When a user has several hours at an airport between flights, your system should suggest activities—grabbing food, browsing shops, using a lounge, taking a brief walk, or even venturing outside the terminal when time allows.
The challenge: any suggestion that leads to a missed connection is an unacceptable outcome. Your design must prioritize safety over optimization.
The problem is intentionally underspecified. You need to identify missing requirements, state your assumptions clearly, and make principled design choices that balance user value against operational risk.
What You Should Cover
Design the system from concept to implementation. Include:
- How you'd scope the initial product given limited information
- The data model for time budgeting and activity feasibility
- System architecture and component responsibilities
- How you ensure recommendations stay safe as conditions change
- What you'd measure and how you'd iterate
Information You Can Work With
Your system has access to:
- Flight itinerary: arrival/departure times, gates, terminals
- Airport layout: terminal maps, walking distances, security checkpoints
- Activity database: restaurants, shops, lounges, their locations and hours
- Real-time updates: gate changes, delays, boarding times
Key Design Constraints
- Missing a flight due to your recommendation is catastrophic
- Layover durations vary from 45 minutes to 8+ hours
- Airport familiarity varies widely across users
- Data quality and completeness differ by airport
- Flight statuses change; gates reassign; delays happen
You should propose reasonable targets for latency, scale, and accuracy rather than assuming they're given.
Hints
Hint 1
Start by defining what makes a recommendation 'safe' in quantitative terms—how much buffer time is enough?
Hint 2
Think about the difference between generating candidate activities and filtering them for feasibility—which constraints are hard vs. soft?
Hint 3
Consider what happens when data is missing or stale: should the system fail open (permissive) or closed (conservative)?
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Product Framing and Scope
First, clarify the problem space through key questions:
Target audience: Start with business and leisure travelers making domestic connections at major hubs. Defer families with children, premium-only features, and international connections to later phases.
Geographic scope: Launch at 5-10 tier-1 airports with reliable data (major US hubs where terminal maps, merchant databases, and typical walking times are well-documented).
Feature boundaries for v1: In-terminal recommendations only. Activities outside security require re-entry time that's too variable to model safely in the first version.
User intent: Optimize for "help me use my time well without stress" rather than "maximize my layover experience." Safety and peace-of-mind trump perfect personalization.
Business model: Start attribution-free to build trust. Layer in affiliate partnerships (dining, retail) and lounge bookings once core reliability is proven.
Core Safety Model: Time Budgeting
The fundamental insight: treat available time as a constrained resource with mandatory reserves.
Time budget calculation:
available_time = departure_boarding_time - current_time - buffer
Where buffer includes:
- Walking time from activity location to departure gate (from pre-computed graph)
- Security/re-entry overhead if leaving secure area (15-25 min depending on airport/time)
- Activity duration estimate (meal: 30-45min, shopping browse: 15-20min, etc.)
- Safety margin: 20-30 minutes minimum, scaling with uncertainty
Conservative defaults under uncertainty:
- No boarding time provided? Use departure time minus 45 minutes
- Gate not assigned? Use farthest gate in departure terminal as worst case
- Unknown walking time? Use 90th percentile historical distance
- First time at this airport? Add 10 minute orientation penalty
The system fails safe: missing data triggers larger buffers, not aspirational estimates.
System Architecture
Client (Mobile App):
- Captures itinerary via boarding pass scan, email parse, or manual entry
- Streams location updates when user permits (terminal/gate proximity)
- Displays recommendations with explicit time commitments and "safe until" timestamps
- Triggers alerts when conditions change (gate reassignment, shorter timeline)
API Gateway / Backend Services:
- Authentication and user session management
- Rate limiting and request validation
- Routes to recommendation and monitoring services
Flight Status Service:
- Polls airline APIs and aggregated flight data providers (e.g., FlightStats, OAG)
- Refresh frequency: every 60-90 seconds for active layovers
- Caches responses; pushes updates via pub/sub when changes detected
- Handles gate changes, delays, early boardings, cancellations
Airport Content Store:
- Database of activities: restaurants, shops, lounges, restrooms, charging stations
- Operating hours, typical wait times, location coordinates
- Pre-computed walking time graph between points of interest
- Updated weekly from airport authority feeds and merchant partnerships
Recommendation Engine:
Stage 1 - Candidate Generation: Generate all activities within the user's current terminal and adjacent connected terminals. Don't filter yet—just retrieve candidates.
Stage 2 - Hard Feasibility Filter: For each candidate, compute:
required_time = walking_to_activity + activity_duration + walking_to_gate + buffer
feasible = required_time <= available_time
Reject anything that fails this test. This is non-negotiable safety logic.
Stage 3 - Ranking: Score remaining candidates on:
- Time fit: activities that use 40-70% of available time rank higher than very short ones
- User preferences (cuisine, retail categories) when known
- Social signals: popularity, ratings
- Operational data: current wait times, crowding
Return top 5-8 with explicit time breakdowns.
Time-to-Leave Monitor: Background service that continuously recalculates time budgets as clock advances and flight data updates. Pushes notifications when:
- 30 minutes before recommended departure from current activity
- Gate change detected
- Delay increases available time significantly (suggest new activities)
- Available time drops below threshold (return to gate immediately)
Data Stores:
- User sessions and preferences: Redis for hot state, Postgres for persistence
- Flight status cache: Redis with 2-minute TTL
- Airport and activity data: Postgres with spatial indexing for location queries
- Event logging: append-only log (Kafka or Kinesis) for recommendation decisions and outcomes
Evolution and Iteration
Phase 1 - Rules-Based MVP (Months 1-3): Hard-coded time budgets, fixed activity durations, deterministic feasibility checks. No personalization. Goal: prove core safety model works.
Phase 2 - Real-Time Context (Months 4-6): Integrate actual wait-time APIs from restaurants and security queues. Refine walking time estimates with user-specific pace when tracked. Improve buffer calculations using historical outcome data.
Phase 3 - Personalization (Months 7-12): Learn user preferences from past behavior and explicit feedback. Introduce light ML ranking models trained on engagement signals. A/B test against rule-based baseline with strict safety guardrails.
Phase 4 - Transactions (Year 2): Enable in-app ordering, lounge booking, wayfinding with AR. Partner with airports and merchants. Monetize via commissions while maintaining recommendation integrity.
Metrics and Monitoring
Safety (non-negotiable):
- Near-miss rate: users within 10 minutes of boarding when reaching gate
- Buffer adequacy: actual time remaining vs. predicted at decision time
- False negative rate: users who stayed idle when safe activities existed
Product health:
- Recommendation acceptance rate
- Activity completion rate (did they actually go?)
- Session frequency and retention
- Time-to-first-action after layover begins
System reliability:
- API latency: P95 under 300ms for recommendation requests
- Flight data freshness: 90% of updates within 2 minutes of real change
- Alert delivery: push notifications within 30 seconds of trigger event
Business (later phases):
- Affiliate conversion rate
- Revenue per recommended activity
- Partner satisfaction scores
Common Pitfalls to Avoid
Over-optimizing for engagement: Suggesting a great restaurant 35 minutes away with a 40-minute available window is not "borderline"—it's unacceptable. Engagement metrics must never override safety constraints.
Ignoring data quality: Real airports have incomplete maps, merchants change hours without notice, and walking times vary by accessibility needs. The system must degrade gracefully when data is missing or suspected stale.
Underestimating real-world variance: Gate changes happen. Users stop for unexpected bathroom breaks. Boarding starts early. Security lines spike. Build margin for the unexpected, not the average case.
Assuming users trust the system immediately: Early versions should over-explain. Show your math: "This gives you 45 minutes to eat with 25 minutes to spare." Transparency builds confidence.