Get startedTutorials

Tutorial - Build a Housing Rental Platform

Overview

The travel accommodation landscape has been revolutionized by platforms like Airbnb, which have transformed how people find and book lodging worldwide. Modern travelers increasingly prefer the personalized experience of vacation rentals over traditional hotels. In China, platforms like Meituan and Fliggy have popularized homestay bookings among domestic travelers.

This tutorial serves as the foundation of our series, demonstrating how to leverage Tacnode's powerful database capabilities to build a comprehensive rental management system. You'll learn to implement core features that every rental platform needs:

  • Property Management: Create, update, and manage property listings
  • Dynamic Search: Enable users to find properties that match their criteria
  • Data Integrity: Ensure reliable data storage and retrieval

Sample Dataset

Throughout this tutorial series, we'll use real Airbnb listing data from Hong Kong (September 2023) to demonstrate practical implementation techniques. You can download the sample data from Inside Airbnb.

This dataset provides realistic property information including pricing, amenities, host details, and guest reviews - perfect for building a production-ready rental platform.

Environment Setup

Before we begin building our rental platform, let's set up the development environment:

1. Create a New Nodegroup

First, you'll need to set up a Tacnode instance. Follow our Tacnode in 10 minutes guide for detailed setup instructions.

2. Establish Database Connection

Once your Nodegroup is ready, establish a connection following the Nodegroup Network documentation.

3. Create the Property Listings Table

Let's create our main listings table to store property information:

CREATE TABLE IF NOT EXISTS listings(
    "id" BIGINT NOT NULL PRIMARY KEY, -- Unique property identifier
    "listing_url" TEXT, -- Property details page URL
    "name" TEXT, -- Property title/name
    "price" DOUBLE PRECISION, -- Rental price in HK$
    "beds" INT, -- Number of beds available
    "amenities" JSONB, -- Property amenities (semi-structured data)
    "has_availability" TEXT, -- Availability status
    "host_verifications" JSONB, -- Host verification methods
    "number_of_reviews" INT, -- Total review count
    "number_of_reviews_l30d" INT, -- Reviews in last 30 days
    "longitude" DOUBLE PRECISION, -- Geographic coordinate
    "latitude" DOUBLE PRECISION, -- Geographic coordinate
    "description" TEXT -- Detailed property description
);

4. Load Sample Data

Now let's populate our table with sample data to work with. The sample data includes a variety of property types, from budget hostels to luxury condos:

INSERT INTO listings(id, listing_url, name, price, beds, amenities, has_availability, host_verifications, number_of_reviews, number_of_reviews_l30d, longitude, latitude, description) VALUES
(17891, 'https://www.airbnb.com/rooms/17891', 'Rental unit in Hong Kong Island · ★4.76 · Studio · 1 bed · 1 bath', 1400.0, 1.0, '["TV", "AC - split type ductless system", "Fire pit", "Coffee maker", "Refrigerator", "Elevator", "Outdoor furniture", "Kitchen", "Pets allowed", "Washer", "Wifi", "Dedicated workspace"]', 't', '["phone", "work_email"]', 73, 0, 114.14988, 22.28327, 'Gorgeous and spacious loft in premium location. Featured in design magazines and listed among Airbnb''s Top 40 Rentals Worldwide. Perfect for both short-term stays and commercial shoots.'),
(505456, 'https://www.airbnb.com/rooms/505456', 'Rental unit in Sheung Wan · ★4.68 · 1 bedroom · 2 beds · 1 bath', 900.0, 2.0, '["Microwave", "Books and reading material", "Hair dryer", "Bay view", "Refrigerator", "Elevator", "Wifi", "Coffee", "Stove", "Ocean view", "Air conditioning", "Kitchen", "Pets allowed"]', 't', '["email", "phone"]', 267, 1, 114.1489, 22.28543, 'Bright and cozy apartment on charming Po Hing Fong street in historic Sheung Wan district. Walking distance to cafes, galleries, and Central business district.'),
(540892, 'https://www.airbnb.com/rooms/540892', 'Rental unit in Sheung Wan · ★4.0 · 1 bedroom · 3 beds · Half-bath', 950.0, 3.0, '["Smoke alarm", "Fire extinguisher", "Hair dryer", "Elevator", "Air conditioning", "Kitchen", "Pets allowed", "Wifi"]', 't', '["email", "phone"]', 10, 0, 114.15241, 22.2858, 'Spacious private bedroom in popular Sheung Wan location. Part of large 3,000 sq ft apartment, ideal for families or groups of 3-4 people.'),
(646645, 'https://www.airbnb.com/rooms/646645', 'Hostel in Hong Kong · ★4.53 · 1 bedroom · 1 bed · 3 shared baths', 280.0, 1.0, '["Smoke alarm", "Essentials", "Self check-in", "Hair dryer", "Air conditioning", "Kitchen", "Pets allowed", "Wifi"]', 't', '["email", "phone"]', 37, 0, 114.16433, 22.32532, 'Experience authentic Hong Kong culture in Shamshuipo. Budget-friendly accommodation with modern amenities and local neighborhood atmosphere.'),
(849316, 'https://www.airbnb.com/rooms/849316', 'Rental unit in Causeway Bay · ★4.50 · 1 bedroom · 1 bed · 1 bath', 800.0, 1.0, '["Microwave", "Hair dryer", "Refrigerator", "Wifi", "Kitchen", "Pets allowed", "Dedicated workspace"]', 't', '["email", "phone", "work_email"]', 100, 1, 114.18156, 22.27742, 'Full apartment in heart of Causeway Bay, one block from Times Square. Convenient location with excellent shopping, dining, and transportation access.');

Core Platform Features

Now that our environment is set up, let's implement the essential features of our rental platform.

Feature 1: Property Management

Creating New Listings

Property owners need an easy way to list their properties. When a host submits a new listing through our platform, the backend processes the information and creates a new database record:

INSERT INTO listings(
    id,
    listing_url,
    name,
    price,
    beds,
    amenities,
    has_availability,
    host_verifications,
    number_of_reviews,
    number_of_reviews_l30d,
    longitude,
    latitude,
    description
) VALUES (
    104626,
    'https://www.airbnb.com/rooms/104626',
    'Rental unit in Hong Kong · ★4.38 · 1 bedroom · 1 bed · 1.5 baths',
    2336.0,
    1.0,
    '["Wifi", "Kitchen", "Air conditioning", "TV with standard cable"]',
    't',
    '[]',
    0,
    0,
    114.1479,
    22.2836,
    'Modern apartment with excellent amenities and convenient location'
);

This operation adds a new property to our platform, making it immediately available for guests to discover and book.

Updating Property Information

Market conditions change, and hosts need flexibility to adjust their pricing and property details. Here's how to update an existing listing:

-- Update property pricing
UPDATE listings 
SET price = 2000 
WHERE id = 17891;
 
-- Verify the change was applied
SELECT id, price 
FROM listings 
WHERE id = 17891;

Expected Result:

  id   | price
-------+-------
 17891 |  2000

This functionality allows hosts to respond to market demand, seasonal pricing, or changes in their property's value proposition.

Feature 2: Property Discovery

Travelers need to find properties that match their specific requirements. Our search system allows filtering by multiple criteria:

SELECT 
    id,                -- Property identifier
    listing_url,       -- Link to detailed listing page
    price,             -- Current pricing information
    number_of_reviews, -- Social proof through review count
    longitude,         -- Geographic data for map integration
    latitude
FROM listings
WHERE 
    has_availability = 't'           -- Only show available properties
    AND amenities ? 'Beach view'     -- Filter for specific amenities
ORDER BY price;                     -- Sort by affordability

Expected Result:

   id    |             listing_url              | price  | number_of_reviews |     longitude      |     latitude
---------+--------------------------------------+--------+-------------------+--------------------+-------------------
  494271 | https://www.airbnb.com/rooms/494271  | 700.0  |                 0 | 114.00395029676515 | 22.27184274100326
 1229848 | https://www.airbnb.com/rooms/1229848 | 1000.0 |                30 |          114.21369 |          22.21892

This query demonstrates Tacnode's ability to efficiently handle complex searches across both structured data (price, availability) and semi-structured data (amenities stored as JSONB).

Key Benefits Demonstrated

Through this foundational tutorial, we've showcased several key advantages of using Tacnode for rental platform development:

1. Flexible Data Storage

The amenities field uses JSONB format, allowing each property to have different amenities without requiring schema changes. This flexibility is crucial for rental platforms where property features vary widely.

2. Efficient Querying

Tacnode's JSONB support enables complex searches like amenities ? 'Beach view' to run efficiently, even on large datasets.

3. Geographic Capabilities

Built-in support for longitude/latitude coordinates enables mapping features and location-based searches.

4. Scalable Architecture

The platform foundation we've built can handle everything from small local rental businesses to large-scale marketplace applications.

What's Next?

This tutorial established the core foundation of our rental platform. In the next tutorial, Property Search & Review, we'll enhance our platform with:

  • Advanced search functionality with full-text search capabilities
  • User review and rating systems
  • Sophisticated filtering options
  • Calendar-based availability checking

These features will transform our basic platform into a comprehensive, user-friendly rental marketplace that rivals commercial solutions.