How this was built, and how the MLS sync works
This is an original demonstration site for a fictional brokerage. It is not a copy of any real brokerage's website. It copies no text, images, logos, layout code or listing data from anyone, and nothing was collected from any listing portal or MLS website. Sample data only.
What you are looking at
A complete independent-brokerage website: search with filters, list, grid and map views; listing pages with galleries, price history and a payment calculator; city and neighborhood pages with statistics; saved homes and searches; agent, sell and blog pages; and a commute search that finds homes within a drive time of every place you go. Pages are rendered on the server, JavaScript is limited to the gallery, the map, the filters and the calculator, and every page works on a phone.
All 400 listings are generated. Street names are real names of roads in each city, but house numbers are invented and no generated address is a real listing. Subdivision names are used only to say roughly where a demo listing is. Photos are AI-generated images of fictional homes, not pictures of any real property. The agents are fictional.
The listing sync
Listings arrive through a pipeline that does not care where they come from. An adapter turns one upstream feed into a common record; the same code then decides what changed and stores it. The demo runs a generated feed through exactly the pipeline a real MLS feed would use.
- Tables (created on first use, with
CREATE TABLE IF NOT EXISTS):re_listings,re_listing_photos,re_listing_price_history,re_sync_runs,re_sync_cursor. There_prefix keeps them apart from the site's other tables. Every row and every query carries a workspace and a source, so several brokerages or several feeds can share the tables. - Incremental by modification time. A cursor remembers the newest source modification timestamp seen. Incremental runs ask only for records modified at or after it (inclusive, so a record sharing the last timestamp is never missed; repeats are harmless because the sync is idempotent).
- Full runs. The first run, and every 4th run after it, reads the whole active inventory. Only a complete run can notice that a listing has left the feed.
- Upsert and status transitions. A content hash decides whether a record changed. Allowed moves: active to pending, sold or withdrawn; pending back to active, or on to sold or withdrawn; sold or withdrawn back to active only as a relist. Other jumps are refused and counted as warnings. A record older than the stored one is skipped as stale.
- Soft delete. A for-sale or pending listing missing from 2 complete runs in a row is hidden (marked withdrawn with a deleted timestamp) but kept, and it comes back by itself if the feed returns it. Closed sales are never removed this way.
- History. Price changes, status changes, relists and removals are recorded once each (a unique key makes replays harmless), which is what the price history table on a listing shows.
- Run summary. Each run stores mode, trigger, counts (added, updated, unchanged, removed, restored, stale, warnings, errors), duration, the cursor before and after, and a note. The footer shows "Last synced" from the latest good run; an admin-only page lists the history.
- Protection. Runs are rate limited (at least 60 seconds apart unless an admin forces one), a lock stops two runs overlapping (stale after 5 minutes), a failed fetch is recorded and does not move the cursor, and the run endpoint needs an admin sign-in. The platform's minute sweep calls the scheduled entry point; the demo seed only advances every six hours.
- First request. Nothing has to be set up: the first visit creates the tables and runs the generated feed through the pipeline (979 listings are loaded now). If no database is bound at all, the pages fall back to generated listings held in memory.
Each run of the demo seed advances one simulated market step: some price drops, a few homes go pending, some pending homes close, new listings appear, and occasionally one leaves the feed, so you can watch incremental updates and the soft-delete rule work.
Adapters
- demo-seed
- Generated, deterministic, running now. Verified by tests, including the whole pipeline against a real SQL database.
- reso-web-api
- The production path for a brokerage with an MLS membership and a data license (Triangle MLS or another). An OData v4 RESO Web API client: OAuth 2 client credentials, a
$filteronModificationTimestamp, paging by@odata.nextLinkor$skip,$expand=Media, retry with backoff, and a mapper for the RESO Data Dictionary fields (ListingKey, ListPrice, StandardStatus, BedroomsTotal, BathroomsTotalInteger, LivingArea, YearBuilt, address parts, City, PostalCode, Latitude, Longitude, PropertyType, PropertySubType, PublicRemarks, ListOfficeName, ModificationTimestamp, Media and more). Verified against hand-written fixtures only; it has never talked to a real MLS server. It stays disabled untilRESO_API_URL,RESO_TOKEN_URL,RESO_CLIENT_IDandRESO_CLIENT_SECRETare set in the environment; nothing is hardcoded.
What a live MLS feed requires
- An MLS membership and a signed IDX or data license. The MLS, not this code, decides what may be shown. The broker must supply the MLS-specific wording and rules.
- Attribution on every listing: the listing brokerage, usually the listing agent where required, the MLS name and the required disclaimer text.
- Refresh cadence: many MLSs require data to be refreshed at least daily and withdrawn or sold listings removed promptly, so the sync should run every few minutes and the rate limits above are tuned for that.
- Display rules: honor the seller's opt-outs (the mapper skips records marked not for internet display and withholds addresses marked not for display), show only fields the license allows (no confidential remarks or showing instructions), and respect photo permissions and limits.
- Do not mix sources in a way that hides which listings came from which MLS, and keep sold data to the period the license allows.
The map
Each listing page shows a real street map: Leaflet with OpenStreetMap tiles, loaded only when the map scrolls into view, with attribution shown. Because the brokerage and its listings are fictional, the map marks an approximate area with a shaded circle rather than an exact pin, so it cannot point at a real house. OpenStreetMap's public tile servers suit a demo's traffic but are not meant for a busy commercial site, so a production brokerage site would use a commercial tile provider or a self-hosted tile server. The search, city and commute pages still use a schematic SVG scatter with zoom, drag and keyboard focus. This is the only third-party request the demo makes.
Commute search
You choose one to three destinations from a list of Triangle places or by dropping a pin, set the longest drive you accept for each, an importance weight and a departure window (weekday morning rush, evening rush, midday, weekend). Homes inside every limit are shown, ranked so that the longest single trip is as short as possible; you can instead rank by total time or weighted time. Every result shows its minutes to each destination, an overall fit score and the tightest trip. The state is in the URL, so a result can be shared or saved.
Drive times in this demo are estimates, not live traffic: straight-line distance times a winding factor, a speed profile by distance band, and a time-of-day multiplier. It is deterministic, free and needs no key. The search first drops homes outside every destination's bounding box, caps the candidates, and memoizes pairs, so it stays fast.
For production, the same interface accepts a routing matrix provider: Google Distance Matrix, Mapbox Matrix or a self-hosted OSRM, each behind an environment key with request batching, caching by rounded coordinates and time bucket, and a quota guard. Rough cost shape (check current prices): Google and Mapbox bill per origin-destination element with a free monthly allowance, so a cache and a bounding-box prefilter matter; a self-hosted OSRM has no per-call fee but needs a server and does not model traffic by time of day. The public OSRM demo server must never be used in production. Typed addresses need a geocoder (also pluggable, keys required); the demo does not call one.
Fair Housing and content
Listing text, neighborhood pages and blog posts describe the property and the place, never the people. Generated copy is checked in tests against a blocklist of steering language (family status, religion, race, national origin, disability, age, school or safety claims, and words like "desirable" or "exclusive"). Neighborhood pages use a fixed vocabulary for location, era, housing types and amenity categories. School and crime information is deliberately not included. Neighborhood names are used only as geographic references, with no claim of affiliation, and every statistic carries the note "Sample data for demonstration, not actual market data for this neighborhood". HOA fees on listings are clearly synthetic values; no homeowners association is named anywhere.
Privacy, indexing and performance
- No accounts. Saved homes and searches live in this browser's local storage. The tour, question and valuation forms send and store nothing and say so.
- Every page is marked
noindex, nofollowin the page and in the response header, has no canonical address, and is in no sitemap. - Light and dark modes, reduced-motion support, keyboard-reachable gallery and map, labelled forms, and images with width and height and lazy loading.