Design a Property Listing Platform (Airbnb)
HardReal World SystemsBookingSearchAvailability CalendarConcurrencyReviews
Problem Statement
Design a property rental marketplace like Airbnb where hosts list properties, guests search and book stays, payments are processed, and reviews are exchanged — with concurrent booking prevention.
Requirements
Functional Requirements
- Host registration and property listing: address, type (APARTMENT/HOUSE/ROOM), amenities, photos, price/night, house rules
- Guest search: filter by location, dates, guests count, price range, amenities
- Availability calendar: hosts block dates; system tracks booked vs available dates
- Booking flow: search → select → hold (10 min) → pay → confirm
- Payment processing and host payout after check-in
- Reviews: guest reviews property after stay; host reviews guest
- Cancellation policies: FLEXIBLE, MODERATE, STRICT
- Messaging between host and guest
- Wishlist: guests save favorite listings
Non-Functional Requirements
- Thread-safe date availability check and booking
- Singleton AirbnbService
Key Entities
- Property: id, host, type, location, capacity, amenities, pricePerNight, availabilityCalendar, reviews
- Booking: id, guest, property, checkIn, checkOut, guestsCount, totalPrice, status
- AvailabilityCalendar: propertyId, blockedDates (Set<LocalDate>)
- Review: id, reviewer, reviewee, property, rating, comment, type (GUEST_FOR_HOST / HOST_FOR_GUEST)
- Host/Guest: user profiles with specific attributes
- CancellationPolicy: enum + refund calculation strategy
Constraints
- Date overlap check must be atomic
- Booking hold expires in 10 minutes without payment
- Cancellation refund based on policy and days before check-in
- Host cannot book their own property
- Reviews only allowed after stay completion
!Constraints
- Date availability check and booking are atomic — no double-booking
- Booking hold expires in 10 minutes
- Reviews unlocked only after stay COMPLETED status
- Host cannot book their own property
- Cancellation refund calculated based on policy and notice period
Output
Run or submit your code to see output here.