logo

Overview

Source: The System Design Newsletter — Neo Kim
Airbnb connects millions of hosts and guests globally. Its system must handle complex inventory search (location-based, date-based, dynamic pricing), real-time availability, payments, and trust/safety — all at global scale.

Key Concepts

Geospatial Indexing — Listings are indexed by location using spatial data structures (S2 cells, GeoHash, or PostGIS) to efficiently answer "find listings near me" queries.
Availability Calendar — Each listing has a calendar of blocked/available dates. Concurrent booking attempts must be handled safely (optimistic locking or distributed locks).
Dynamic Pricing (Smart Pricing) — ML-driven price recommendations adjust based on demand, seasonality, local events, and competitor pricing.

Core Components

  • Search Service — Queries listing index (Elasticsearch) filtered by location, dates, guests, amenities, price. Returns ranked results.
  • Listing Service — CRUD for host listings. Writes to primary DB and indexes Elasticsearch.
  • Availability Service — Manages the date-based availability calendar. Prevents double-booking via atomic reservation logic.
  • Booking Service — Orchestrates the reservation flow: hold availability → process payment → confirm booking.
  • Payment Service — Handles guest charges and host payouts across multiple currencies.
  • Review Service — Two-way reviews from guests and hosts. Reviews published after both parties submit or after a deadline.
  • Messaging Service — In-platform communication between hosts and guests.
  • Trust & Safety Service — Fraud detection, ID verification, content moderation.

Search & Discovery Flow

  1. Guest enters location, dates, guest count
  1. Search Service queries Elasticsearch with geo-filter + date availability filter
  1. Results ranked by relevance, price, reviews, and ML ranking model
  1. Listing photos served from CDN
  1. Prices computed in real-time (base price × dynamic pricing factor)

Booking Flow (Preventing Double-Booking)

  1. Guest selects listing + dates → "Hold" placed on availability (optimistic lock)
  1. Payment authorization requested
  1. If payment succeeds → availability record updated atomically → booking confirmed
  1. If payment fails → hold released
  1. Email/push notifications sent to both parties

Scale Considerations

  • Elasticsearch for geo + full-text search on millions of listings
  • CDN for listing photos (most traffic is reads)
  • Read replicas for listing/review queries
  • Distributed caching for hot listings (price, availability summary)
  • Idempotency on booking and payment to handle retries safely

Key Trade-offs

Decision
Reasoning
Elasticsearch for search
Supports geo-queries + full-text natively
Optimistic locking for availability
High contention only on popular dates/listings
Async review publication
Prevents bias — neither party sees the other's review first
ML-based ranking
Balances host revenue and guest conversion