Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

House Estate Agents

By Simeon Griggs

Data modelling with dynamic data imports

Property search with filters and live updates as you move the map
Property For Sale page
Location office page
Properties schema with various type and status filters
Individual property document

About the project

Sanity is an excellent choice as a Content Management System, but where it really shines is the Client library to easily query, write and update data from your own custom applications.

The House Estate Agents website had been based on WordPress for many years, using an XML import plugin to pull up-to-date property data on a regular schedule. The problem with this method is how taxing this is on the website's own server every time the update runs.

So we decided to switch to a "Headless" setup with Sanity as the data store at the centre.

Front End

The front-end is fast. Powered by Gatsby, animated with Framer Motion. The most technically impressive page is the Property listings page. With animated live filtering and search results updated by interacting with the map.

Property Imports

The first step was to build a custom importer. The agency uses a property management tool that will upload updated XML files onto a server. We leveraged a tool (FeedSync) – originally built to standardise these XML files in preparation to import into WordPress – as an API for an import tool of our own.

We created a simple Express.js App, hosted on Heroku, to hit this endpoint on a regular schedule and read the data, compare it to the current Sanity dataset and update accordingly.

The App will update existing properties, create new ones and remove any that are no longer being listed. At the end of each import, a new build of the site is created.

The importer will even dynamically create new Suburb, Agent and even Office documents if necessary. And add references to them as required. There's no need for the agency to prepare new documents in Sanity ahead of time. They just extend whatever the importer creates.

Data Backups

For this project we were also asked to provide regular backups of the dataset. And again, because Sanity's Client API is so rich – this was easy to build.

Backups can be triggered on demand, or on a schedule, to Amazon S3 with an email notification and instant download link.

Contributor

Other projects by author