0%
System requirements
Functional
Capacity estimation
Traffic
API design
Baggage Check-In
Database design
PostgreSQL Schema
High-level design
Request flows
Flow 1: Baggage Check-In and Sorting Pipeline
Detailed component design
GATE: The Tracking-and-Sorting Pipeline
Trade-offs and tech choices
RFID vs Barcode Tags
Failure scenarios and bottlenecks
Tracking Service Outage
Future improvements
GPS and BLE Continuous Tracking
AI-Powered Misroute Prediction
System requirements
Functional
Capacity estimation
Traffic
API design
Baggage Check-In
Database design
PostgreSQL Schema
High-level design
Request flows
Flow 1: Baggage Check-In and Sorting Pipeline
Detailed component design
GATE: The Tracking-and-Sorting Pipeline
Trade-offs and tech choices
RFID vs Barcode Tags
Failure scenarios and bottlenecks
Tracking Service Outage
Future improvements
GPS and BLE Continuous Tracking
AI-Powered Misroute Prediction
An airport baggage handling system is the automated infrastructure that moves checked luggage from the airline counter to the aircraft hold and back to the passenger at the destination. Every major airport operates one. When you check a bag at the counter, it disappears behind a rubber curtain and reappears on a carousel at your destination. Between those two moments, the bag passes through a complex pipeline of conveyors, scanners, sorting junctions, and loading areas, all coordinated by software that tracks every bag in real time.
The scale is significant. A large international hub like Atlanta Hartsfield handles over 200,000 bags per day. Even a mid-sized airport processes 50,000 to 80,000 bags daily. Each bag is scanned 10 to 20 times as it moves through the system, generating hundreds of thousands of scan events per day. The system must route every bag to the correct flight, detect misrouted bags within minutes, and keep passengers informed. Failure means delayed flights, lost luggage, and millions in airline compensation costs. The International Air Transport Association estimates that mishandled baggage costs the airline industry over $2 billion annually.
Start with bag volume and work down to scan event rates. The key metric is scan events per second because that drives the message queue and tracking service sizing.
The API has three distinct consumers with different needs: check-in agents registering bags, the internal scanner network publishing scan events, and passengers or airline staff querying bag status. Each consumer has different authentication, rate limiting, and latency requirements.
POST /api/v1/baggage/checkinThe data layer uses PostgreSQL for transactional bag and flight records, a time-series optimized approach for high-volume scan events, and Redis for caching routing rules and hot bag status.
Why not a single database for everything? Because bag records and scan events have fundamentally different access patterns. Bag records are read and updated frequently (status changes on every scan), require transactional consistency (two concurrent scan events for the same bag must not corrupt state), and are queried by multiple keys (tag ID, passenger ID, flight ID). This is relational data that PostgreSQL handles well. Scan events are append-only, high-volume, time-ordered, and rarely queried individually. They are a natural fit for time-series storage with partition-based retention. Using PostgreSQL for both would work at this scale (6.7GB is small), but separating them lets you optimize retention policies and query patterns independently.
The architecture bridges two worlds: the physical world of conveyors, scanners, and mechanical diverters, and the software world of message queues, databases, and APIs. The physical layer moves bags. The software layer decides where to move them and tracks every movement.
Think of it like a postal sorting facility. Letters (bags) arrive at the intake (check-in), pass through sorting machines (conveyor junctions), and end up in delivery bins (gate loading areas). Postal workers (ground crew) handle exceptions. The tracking system is the clipboard that records where every letter went. The difference from a real postal system is speed: bags move at 5 to 10 meters per second on conveyors, and sorting decisions must happen in milliseconds, not minutes.
Two primary flows define the system: bag check-in through the sorting pipeline (write path) and bag status tracking (read path). The write path is event-driven and latency-critical because it controls physical sorting. The read path is query-driven and latency-tolerant because it serves informational lookups.
This flow starts when a passenger hands their bag to the check-in agent and ends when the bag is loaded onto the aircraft. The total time is typically 30 to 90 minutes, dominated by physical conveyor transit and wait times at the gate loading area.
Mid-level: describe the scan-to-sort pipeline and explain how Kafka buffers events.
Senior: explain idempotent scan processing with Redis deduplication, walk through the sorting junction cache strategy, and design the departure reconciliation logic.
Staff: design graceful degradation for tracking service outages, calculate the cache staleness trade-off for routing rules, and propose a cross-airport transfer tracking protocol.
The tracking-and-sorting pipeline is the core mechanism that makes the entire system work. Every other component exists to feed it (scanners), support it (Kafka, PostgreSQL), or consume its output (notifications, dashboard). If you understand this pipeline deeply, the rest of the architecture follows logically.
RFID tags cost $0.10 to $0.50 each versus pennies for printed barcodes. At 80,000 bags per day, the tag cost difference is $8,000 to $40,000 per day, or $3 million to $14 million per year. This is a real cost that airport operators weigh carefully. But RFID provides contactless bulk scanning (read 200 tags per second from 3 meters away versus 1 tag per second with line-of-sight for barcodes). At a sorting junction processing 1.4 bags per second, RFID reads every bag reliably while barcode scanning has a 5 to 10 percent failure rate from tag orientation, damage, or obstruction. Each failed read diverts a bag to the manual sorting lane, costing roughly $5 in ground crew labor per bag. At 80,000 bags per day with 5 percent failure rate, manual handling costs $20,000 per day, roughly $7 million per year. RFID's higher tag cost pays for itself through reduced manual handling. IATA's Resolution 753 requires airlines to track bags at four key points (check-in, loading, transfer, arrival), and RFID makes this compliance significantly easier.
When discussing the RFID versus barcode trade-off in an interview, lead with the numbers. RFID tags cost 10 to 50 cents each but reduce manual handling from 5 percent to under 1 percent of bags. At 80,000 bags per day, RFID saves roughly 3,200 manual sorts daily. Each manual sort costs 5inlabor.Annualsavings:5.8 million. The tag cost premium is 3to14 million per year. At most airports the ROI is within 2 to 3 years.
If both tracking service instances fail simultaneously, scan events accumulate in Kafka but no processing occurs. Sorting commands stop flowing to junction controllers. Notifications stop.
Impact: Junction controllers continue operating with cached routing rules. Bags arriving at junctions are sorted using the last known flight-to-gate mapping. If no gate changes occurred since the last cache refresh, 100% of bags are sorted correctly. If gates changed during the outage, bags for affected flights go to the wrong gate. The operations dashboard goes dark, losing real-time visibility. Passenger notifications are delayed until service recovery.
Current checkpoint-based tracking updates only when a bag passes a scanner, leaving gaps of 2 to 10 minutes between updates. Bluetooth Low Energy beacons spaced along conveyor tunnels can triangulate bag positions continuously, providing meter-level accuracy every few seconds. This enables the live map feature passengers increasingly expect and gives ground crew precise locations for stuck or misrouted bags. The technical challenge is scale: 3,000 in-transit bags generating position updates every 2 seconds produces 1,500 events per second, roughly 55x the current scan event rate. This requires a separate streaming pipeline (Kafka Streams or Apache Flink) and a time-series database (InfluxDB or TimescaleDB) with aggressive TTL (24-hour retention for position data). The RFID checkpoint system remains the source of truth for state transitions and sorting decisions. BLE provides supplementary position data between checkpoints.
Reading a solution is not the same as producing one under interview pressure. Design it on the whiteboard and get scored feedback.
0%
System requirements
Functional
Capacity estimation
Traffic
API design
Baggage Check-In
Database design
PostgreSQL Schema
High-level design
Request flows
Flow 1: Baggage Check-In and Sorting Pipeline
Detailed component design
GATE: The Tracking-and-Sorting Pipeline
Trade-offs and tech choices
RFID vs Barcode Tags
Failure scenarios and bottlenecks
Tracking Service Outage
Future improvements
GPS and BLE Continuous Tracking
AI-Powered Misroute Prediction
System requirements
Functional
Capacity estimation
Traffic
API design
Baggage Check-In
Database design
PostgreSQL Schema
High-level design
Request flows
Flow 1: Baggage Check-In and Sorting Pipeline
Detailed component design
GATE: The Tracking-and-Sorting Pipeline
Trade-offs and tech choices
RFID vs Barcode Tags
Failure scenarios and bottlenecks
Tracking Service Outage
Future improvements
GPS and BLE Continuous Tracking
AI-Powered Misroute Prediction