Build a date-range booking system with a properties collection (name, images, pricePerNight, amenities) and a reservations collection (propertyId, checkIn, checkOut, totalNights, totalPrice, status). Two DateTimePicker widgets select check-in and check-out dates. An availability check queries existing reservations using the overlap formula: existingCheckIn < requestedCheckOut AND existingCheckOut > requestedCheckIn. A Custom Function calculates the total price from nights times nightly rate plus fees. The confirmation page summarizes the booking with a cancellation policy display.
Building a Hotel or Rental Booking System in FlutterFlow
Date-range booking is the foundation of any hotel, vacation rental, or property management app. This tutorial builds the complete flow: property browsing, date selection, availability verification using the overlap formula, dynamic price calculation, booking confirmation, and cancellation handling. It applies to hotels, Airbnb-style rentals, vacation homes, or any multi-night accommodation system.
Prerequisites
- A FlutterFlow project with Firebase Authentication enabled
- Firestore database set up in your Firebase project
- Basic understanding of FlutterFlow DateTimePicker, Backend Queries, and Custom Functions
- Familiarity with Firestore date range queries
Step-by-step guide
Create the properties and reservations Firestore schema
Create the properties and reservations Firestore schema
Create a properties collection with fields: name (String), description (String), images (List of Strings, URLs), pricePerNight (Double), cleaningFee (Double), taxRate (Double, e.g., 0.12 for 12%), amenities (List of Strings), location (String), maxGuests (Integer), bedrooms (Integer), bathrooms (Integer), and hostId (String). Create a reservations collection with fields: propertyId (String), userId (String), checkIn (Timestamp), checkOut (Timestamp), totalNights (Integer), totalPrice (Double), guests (Integer), status (String: 'confirmed', 'cancelled', 'completed'), specialRequests (String), and createdAt (Timestamp).
Expected result: Firestore has properties and reservations collections with all fields needed for date-range booking and price calculation.
Build the property listing and detail pages
Build the property listing and detail pages
Create a PropertyList page with a ListView querying the properties collection. Each card shows the first image, name, location, price per night, and a star rating. Add filter controls: a Slider for max price, a DropDown for number of bedrooms, and a TextField for location search. Create a PropertyDetail page receiving a propertyId parameter. Display an image gallery using a PageView with dot indicators, the property name and location, a price per night badge, the amenities as Wrap Chips, description text, and host information. Below the details, add a 'Check Availability' section with booking controls.
Expected result: Users browse properties in a filterable list and tap to see detailed property pages with image galleries, amenities, and pricing.
Add date range selection and availability checking
Add date range selection and availability checking
In the Check Availability section, add two DateTimePicker widgets: one for check-in and one for check-out. Set the check-in minimum date to today and the check-out minimum date to check-in + 1 day. When both dates are selected, add a Backend Query that checks for conflicting reservations: query reservations where propertyId matches AND status is not 'cancelled' AND checkIn is less than the requested checkOut AND checkOut is greater than the requested checkIn. This is the date overlap formula. If the query returns any results, show 'Dates unavailable' in red. If empty, show 'Available!' in green with the booking button enabled.
Expected result: Users select check-in and check-out dates. The system queries for overlapping reservations and shows availability status in real time.
Calculate total price with nightly rate, cleaning fee, and taxes
Calculate total price with nightly rate, cleaning fee, and taxes
Create a Custom Function called calculateBookingPrice that takes checkIn (DateTime), checkOut (DateTime), pricePerNight (Double), cleaningFee (Double), and taxRate (Double). Calculate totalNights as the difference in days between checkOut and checkIn. Calculate subtotal as totalNights * pricePerNight. Calculate tax as (subtotal + cleaningFee) * taxRate. Return a Map with totalNights, subtotal, cleaningFee, tax, and grandTotal. Display the price breakdown on the PropertyDetail page below the availability check: nightly rate x nights, cleaning fee, taxes, and a bold grand total. Update the breakdown dynamically when dates change.
Expected result: A price breakdown shows the nightly rate multiplied by nights, plus cleaning fee and taxes, with a clear grand total.
Create the booking confirmation flow
Create the booking confirmation flow
When the user taps 'Book Now' on an available property, navigate to a BookingConfirmation page passing propertyId, checkIn, checkOut, totalPrice, and guests. Display a summary: property name and image, dates, guests, price breakdown, and a cancellation policy (e.g., 'Free cancellation until 48 hours before check-in'). Add a specialRequests TextField for notes. Add a 'Confirm Booking' Button that creates a reservation document with status 'confirmed'. For paid bookings, integrate Stripe Checkout before creating the reservation. After confirmation, navigate to a BookingSuccess page with a summary and a 'View My Bookings' button.
Expected result: Users review booking details, confirm the reservation, and see a success page. The reservation document is created in Firestore.
Build the bookings management page with cancellation
Build the bookings management page with cancellation
Create a MyBookings page with a ListView querying reservations where userId equals the current user, ordered by checkIn descending. Display each booking as a card with the property image, name, dates, status badge (green for confirmed, red for cancelled, grey for completed), and total price. Add a Cancel button on confirmed bookings that are more than 48 hours from check-in. On cancel, update the reservation status to 'cancelled' via a Cloud Function that also handles any refund logic. Completed bookings show after the checkOut date passes, with a 'Leave Review' button.
Expected result: Users see all their bookings with status badges and can cancel upcoming reservations within the cancellation policy window.
Complete working example
1// Hotel/Rental Booking System — Action Flow Summary23// PROPERTY DETAIL PAGE:4// Backend Query: properties/{propertyId}5// Display: PageView images, name, location, pricePerNight,6// amenities Wrap, description, host info78// CHECK AVAILABILITY SECTION:9// 1. DateTimePicker: checkIn (min: today)10// 2. DateTimePicker: checkOut (min: checkIn + 1 day)11// 3. On date change:12// a. Backend Query: reservations13// WHERE propertyId == current property14// WHERE status != 'cancelled'15// WHERE checkIn < requestedCheckOut16// WHERE checkOut > requestedCheckIn17// b. IF results.length > 0:18// → Show Text 'Dates unavailable' (red)19// → Disable Book Now button20// c. ELSE:21// → Show Text 'Available!' (green)22// → Enable Book Now button23// 4. Custom Function: calculateBookingPrice(24// checkIn, checkOut, pricePerNight, cleaningFee, taxRate25// )26// → Returns: { totalNights, subtotal, cleaningFee, tax, grandTotal }27// 5. Display price breakdown:28// $pricePerNight x totalNights = $subtotal29// Cleaning fee: $cleaningFee30// Taxes (taxRate%): $tax31// Total: $grandTotal3233// BOOK NOW BUTTON:34// Navigate to BookingConfirmation page35// Pass: propertyId, checkIn, checkOut, grandTotal, guests3637// BOOKING CONFIRMATION PAGE:38// Display: property summary, dates, guests, price breakdown39// TextField: specialRequests (optional)40// Cancellation policy text41// Confirm Booking button:42// 1. Create Document: reservations → {43// propertyId, userId: currentUser.uid,44// checkIn, checkOut,45// totalNights: calculated, totalPrice: grandTotal,46// guests, status: 'confirmed',47// specialRequests, createdAt: now48// }49// 2. Navigate to BookingSuccess (Replace Route)5051// MY BOOKINGS PAGE:52// Backend Query: reservations WHERE userId == currentUser53// ORDER BY checkIn DESC54// Each card: property image, name, dates, status badge, price55// Cancel button (if confirmed AND checkIn > now + 48h):56// Update Document: status = 'cancelled'5758// DATE OVERLAP FORMULA (critical):59// Conflict exists when:60// existing.checkIn < requested.checkOut61// AND existing.checkOut > requested.checkIn62// This catches ALL overlap cases:63// - Existing fully contains requested64// - Requested fully contains existing65// - Overlap at start66// - Overlap at endCommon mistakes
Why it's a problem: Checking date overlap with simple equality instead of the range formula
How to avoid: Use the range overlap formula: existingCheckIn < requestedCheckOut AND existingCheckOut > requestedCheckIn. This catches all four overlap scenarios.
Why it's a problem: Not excluding cancelled reservations from availability checks
How to avoid: Add status != 'cancelled' (or status == 'confirmed') to the availability query filter.
Why it's a problem: Calculating total price on the client without a Custom Function
How to avoid: Centralize the calculation in a single Custom Function that returns a structured breakdown with consistent decimal rounding via toStringAsFixed(2).
Best practices
- Always use the date overlap formula for availability: existingCheckIn < requestedCheckOut AND existingCheckOut > requestedCheckIn
- Exclude cancelled reservations from availability queries
- Show a clear price breakdown with nightly rate, fees, taxes, and grand total
- Set minimum check-out date dynamically based on check-in selection (check-in + 1 day)
- Display the cancellation policy prominently before the user confirms the booking
- Send confirmation emails via Cloud Functions triggered on reservation creation
- Use a transaction when creating the reservation to re-verify availability atomically and prevent double-bookings
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I need to build a hotel booking system in FlutterFlow. Show me the Firestore schema for properties and reservations, the date overlap availability check query, and the Custom Function for calculating total price from nightly rate, cleaning fee, and tax rate.
Create a property detail page with an image gallery PageView, amenities list, and a Check Availability section. Add two DateTimePicker widgets for check-in and check-out dates, an availability query using the date overlap formula, and a price breakdown display with nightly rate, fees, and total.
Frequently asked questions
Can I use a date range picker widget instead of two separate DateTimePickers?
Yes. Create a Custom Widget using syncfusion_flutter_datepicker which supports range selection natively. It provides a more intuitive UX where users drag across a calendar to select their stay dates.
How do I handle seasonal pricing with different rates per date?
Create a pricing_periods collection with startDate, endDate, and pricePerNight. In the calculateBookingPrice function, iterate through each night of the stay and look up the applicable rate for that date.
Can I block specific dates when the property is unavailable for maintenance?
Yes. Create blocked_dates documents with propertyId, startDate, and endDate. Include these in your availability check alongside reservations to ensure maintenance windows block bookings.
How do I prevent double-bookings from two users booking simultaneously?
Use a Firestore transaction in a Cloud Function that re-checks availability before creating the reservation. If another booking was created between the user's availability check and confirmation, the transaction detects the conflict and rejects the booking.
Can I add a minimum stay requirement?
Yes. Add a minimumNights field to the property document. In the UI, validate that the selected date range meets or exceeds the minimum. Disable the Book Now button and show a message if the stay is too short.
Can RapidDev help build a complete property management platform?
Yes. RapidDev can implement a full booking system with channel management, dynamic pricing, host dashboards, guest communication, review systems, and integration with external booking platforms.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation