All case studies

A website that works like a salesperson

The public website of a commercial brokerage, rebuilt so Google and AI assistants can read it, and every lead is pushed to the brokers' phones as it arrives.

~276K
Google search impressions in 91 days, Apr–Jul 2026 Source: Google Search Console export, Apr 25 to Jul 24, 2026
27 → 90
Lighthouse performance score, measured at the time Source: website project history, Feb 20, 2026
150
public pages, each prerendered as full HTML for search engines Source: website route list

The problem

value to confirm

Lornell Real Estate is a small commercial brokerage covering eight submarkets in Central Massachusetts and northern Rhode Island. The firm’s product brief sets the goal: deal flow the firm originates itself, not deals inherited from a listing portal. So the website has one job. It has to be found, earn trust, and turn a visitor into a phone call.

In late November 2025 the site was a single-page React app. It looked finished, but it failed that job in four ways:

  • Google saw an empty page. The content was drawn in the visitor’s browser, so a search crawler received an empty container.
  • It was slow. A performance audit measured 13.7 seconds before the main content appeared on mobile. Lighthouse scored performance at 27.
  • The maps cost money on every page view.
  • Leads arrived as email only. No phone alert, and no link to a CRM.

What I built

I rebuilt it piece by piece into a site that sells, with Claude as a coding agent on 419 of its 570 commits.

  • Pages Google can read. All 150 public pages (40 core pages, 67 articles, 18 listings, 8 submarket pages and 17 research and map-tool pages) ship as full HTML. 136 of them are meant for Google; the 14 thin map-tool pages are marked noindex.
  • Built for AI answers, too. Articles carry direct answers, definitions, sources and FAQ sections, marked up so ChatGPT, Perplexity and Google’s AI Overviews can find and quote them. Every build also generates llms.txt, a plain-text guide to the whole site for AI assistants.
  • One door for every lead. Contact, valuation, offering memorandum, market report, listing alert and newsletter requests all go through one endpoint. The lead is saved first. Then it reaches the brokers’ phones, the team inbox with the brokers copied, the firm’s CRM and the visitor’s inbox as an auto-reply.
  • An AI chat that qualifies visitors, scoring each conversation hot, warm or cold. A hot lead triggers the same alerts as a form.
  • First-party market research. Market reports published in 2026 (a mid-year report and a third-quarter update), built from state assessment data, Census tables and state traffic counts. Median household income is recomputed from the underlying income distribution, because averaging the medians of small areas gives the wrong answer.
  • Listings with real drive-time maps, showing the 5, 10 and 15-minute reach around a property.
  • A seller path: an address-first valuation form and a call bar that stays on screen on mobile.
  • A weekly Search Console report, emailed every Monday, comparing the last 28 days with the 28 before.

Diagram: a visitor reaching prerendered pages on Cloudflare; one lead endpoint writing to the database first; four arrows leaving it (phone alerts, team email, CRM, auto-reply), each marked “can fail without losing the lead”.

The hard parts

Teaching Google to read a React app.

Search engines index what the server sends, and a React app sends an empty shell. There was no server framework to fix that, so I made the build do it: a headless browser opens every page and saves the finished HTML. One list of routes feeds the prerenderer, the sitemaps, the SEO tests and the file that describes the site to AI assistants, so no page can drop out of one of them. It started at 54 routes in January 2026 and now covers 155.

Standard SEO checks aren’t enough on their own. A page can pass every tag test and still ship without its body, because the title loads before the article does. So the prerenderer waits for each page’s main heading and fails the build if one doesn’t appear. That check caught 20 articles that every tag test had passed.

Under the hood
  • scripts/seo-routes.ts is the single registry. scripts/prerender.ts runs a headless Chrome pool at concurrency 5 and recycles pages every 15 batches. Each build saves 155 pages: the 150 public routes, 4 noindex admin and internal shells, and the 404 page.
  • It seeds localStorage so gated research renders in full for crawlers and cookie consent reads “denied”, so no tracker fires during the crawl. It strips baked-in analytics scripts, restores non-blocking fonts and swaps the hero video for a WebP poster.
  • An article missing its body renders at about 11.8 KB. The readiness check is waitForSelector('h1', { timeout: 20000 }), which throws with the route name (commit 1e5705e).
  • After prerender, test-seo.ts and check-seo-guardrails.ts gate the deploy: a trailing slash on every internal link, titles of 60 characters or fewer, descriptions of 155 or fewer, exactly one <h1>.

Closing the soft-404 trap.

Any mistyped address returned the homepage with a “page OK” status. To Google that looks like an endless supply of duplicate homepages. The host returns a true “not found” only if a 404 file exists, and that file would also break the private admin pages, which have no file of their own. So the build renders the 404 page from the app and refuses to ship without it, and the admin pages ship as hidden shells. On September 10, 2026 I checked the live site: a made-up address returns 404.

Under the hood
  • Cloudflare Pages SPA mode served the byte-identical homepage with HTTP 200 and canonical=/ for every unknown path.
  • prerender.ts promotes /404 to dist/404.html and fails the build if it is missing or lacks noindex. /admin/*, /internal/* and /photo-manager are prerendered as noindex shells so they keep returning 200.
  • The same commit collapsed robots.txt to one wildcard group. With per-crawler groups, Googlebot read only its own “Allow: /” block and never saw the Disallow rules.

Being the answer, not just a link: SEO, AEO and GEO.

More buyers now ask an AI assistant before they search. Search engine optimization (SEO) gets a page ranked. Answer engine optimization (AEO) shapes it so a search engine can lift a direct answer from it. Generative engine optimization (GEO) makes it something ChatGPT, Perplexity or Google’s AI Overviews will cite. The site does all three, and measures the result: visits from AI assistants are tracked separately from ordinary search traffic.

Most of the work is editorial discipline, applied everywhere. Articles open with a direct answer, define their terms, cite their sources and end with the questions a buyer actually asks. The site’s 100-question FAQ and the 24 questions on its market pages are written the same way. New FAQ candidates for each town are drafted with AI, and a person approves each one before it goes live.

Under the hood
  • AEO shipped in February 2026 (PR #31): direct-answer blocks, key takeaways and FAQ sections across page types. The GEO work that followed added HowTo schema to 27 articles, DefinedTerm schema built from definition blocks, Dataset schema on market pages, SpeakableSpecification, citations, author credentials and dateModified.
  • Structured data on the live site includes RealEstateAgent, RealEstateListing, Article, FAQPage, DefinedTermSet, Dataset and BreadcrumbList. normalizeSchemaUrls keeps every URL in the JSON-LD graph canonical.
  • generate-llms.ts writes llms.txt (about 18 KB) and llms-full.txt (about 46 KB) from live listing and article data on every build.
  • robots.txt admits AI crawlers (GPTBot, PerplexityBot, Google-Extended and others) through one wildcard group. functions/api/track.js tags referrals from ChatGPT, Claude, Gemini, Perplexity and Copilot.
  • generate-geo-faqs.js drafts location-specific FAQs with Gemini and runs --dry-run before --insert, so nothing publishes unreviewed. submit-indexnow.ts notifies Bing and other IndexNow engines of changes.

Getting a lead to the brokers’ phones in seconds, without ever losing one.

A commercial lead goes cold fast. The first phone alerts ran through a paid notification app. I replaced it with push notifications the site sends itself. Apple’s push service rejected the first library’s encryption, so delivery now uses the newer standard Apple requires. The rule behind the design: the lead is written to the database first, and everything after that (push, email, CRM, auto-reply) can fail without losing it.

Under the hood
  • POST /api/lead handles six intents: alert, report, OM, valuation, newsletter and inquiry. It inserts into D1, records first-touch UTM fields, then hands push, email and the CRM forward to waitUntil. The code comments state the rule: “a push failure must never break lead capture” and “a CRM outage must never break the email path”.
  • Web Push uses VAPID with RFC 8291 aes128gcm. The keys are rebuilt as a JWK so WebCrypto can import them, since the edge runtime has no Node crypto. Subscriptions that answer 404 or 410 are pruned. This replaced Pushover (db5638e).
  • Inquiries, valuations, offering memoranda and report requests go to the firm’s CRM. Newsletter and alert sign-ups don’t.

An AI chat that can’t run up the bill.

A public AI chat is an open tab on the firm’s account. Every visitor gets limits per minute, per day and per conversation, and known bots are turned away. The subtle hole was the conversation history. The browser sends it, so a caller could attach megabytes of fake history to a one-word message, and the firm would pay for a near-full-size request every time. The server now rebuilds the history itself within a fixed budget.

Under the hood
  • Gemini 2.5 Flash. Limits per IP of 12 messages a minute and 100 a day, 50 messages per session, 1,000 characters per message, and bot user agents blocked (functions/api/chat.js).
  • sanitizeHistory() walks the client history backwards so the newest turns survive, keeping at most 20 turns and 25,000 characters.
  • Scores are saved to D1. A hot lead sends one email and one push; a notified_at column prevents repeats.

Results

  • About 276,000 Google impressions and 1,148 clicks in 91 days (April 25 to July 24, 2026). How measured: summed from the Search Console export saved in the repository. A later Search Console reading, taken in September 2026, showed about 292,000 impressions over 90 days.
  • Two articles earned about 102,000 impressions between them in the same 91 days, answering what sellers pay in broker fees and closing costs. How measured: the page-level Search Console export.
  • value to confirm
  • Lighthouse performance 27 → 90 on February 20, 2026. How measured: recorded in the commit message at the time, not re-measured since.
  • Lighter pages. The main JavaScript bundle fell from 788 KB to 306 KB, and 415 listing photos from 82.2 MB to 38.7 MB. How measured: commit messages, February 2026.
  • No map bill. Moving from Google Maps to MapLibre cut the map code from 1,750 to 725 lines (58% less) and removed the per-request charge. How measured: the January 29, 2026 commit.
  • Real 404s. How measured: live check on September 10, 2026.
  • value to confirm

What’s next

  • Turning impressions into clicks. Much of the search traffic is people researching closing costs and broker fees. The September 9, 2026 update rewrote 115 page titles for Google’s results page and fixed 5,806 internal links that redirected. Next: measure click-through in 28-day windows from October.
  • AI-assistant visits in the weekly report. They’re tracked today. Next: report them every Monday beside Google’s numbers.
  • Leads tied to deals. Every lead already records where it came from. Next: report closed deals by lead source in the CRM.
  • Individual sign-in for the lead console, matching the CRM.

Stack

React 19 · TypeScript · Vite · Tailwind CSS · Cloudflare Pages and Functions (D1, KV, R2) · Puppeteer · MapLibre GL · Web Push · Resend · Gemini 2.5 Flash · Vitest

If your website gets seen but rarely produces a call, or never comes up when customers ask an AI assistant, I can build one that gets found and quoted, and puts every lead on your team’s phones the moment it arrives.

Have a similar problem? Book a call.