← back to blog
Case study updated Aug 2026

Pine Ridge Apartments: from a monolith to a content platform built for AI-era search

A real, live leasing site — one developer, ~9,500 lines changed across 51 files. This turned a single-file prototype into a modular platform non-technical staff can publish from, with AI-crawler discoverability baked into the pipeline itself.

Node.js Express Knex + SQLite Handlebars Sharp AIGEO
The problem

One 336-line file doing everything

The entire backend lived in a single index.js: routes, auth logic, mailer setup, database queries, and validation all interleaved. What that actually cost:

The solution

Three things this rebuild had to do

02 · Content platform

A real blog/CMS for a non-technical editor

Create, edit, schedule, and preview posts — including an image pipeline that resizes and cleans up header images automatically — without touching code.

03 · Architecture & security

A monolith split into a real Express app

Routes and shared logic separated into routes/ and lib/ — the precondition for everything above, and the refactor that surfaced and closed the auth gap.

Deep dive

Built for the AI-search era

By 2026, a growing share of apartment search starts inside an AI assistant — "find me a pet-friendly 2-bedroom in Chubbuck under $X" — not a Google results page. A site optimized only for classic crawlers is invisible to that traffic. This rebuild treats AI discoverability as a first-class requirement, not something bolted on after launch.

01 · publish
Staff publish or schedule a post through the CMS
→
02 · regenerate
sitemap.xml and llms.txt rebuild from the same posts table
→
03 · attach
BlogPosting schema attaches with author + breadcrumb data
→
04 · indexed
Discoverable by Google and cited correctly by AI assistants — one step

Every page of new content is published once and simultaneously indexed for Google, structured for AI assistants to cite correctly, and attributed to a consistent, named author — without a second manual step.

Before → after

One file becomes an app

before — index.js (336 lines)
app.get("/", ...)
app.post("/contact", ...)
app.get("/staff/login", ...)
app.post("/staff/login", ...)
app.get("/staff/contact/:id", ...)
app.post("/staff/contact/:id", ...)   // no auth check
app.delete("/staff/contact/:id", ...) // no auth check
// mailer setup inline
// db queries inline
// validation inline
// ...
after — index.js (bootstrap only)
const { app } = require("./lib/app");

app.use("/", require("./routes/home"));
app.use("/blog", require("./routes/blog"));
app.use("/author", require("./routes/author"));
app.use("/", require("./routes/seo"));
app.use("/contact", require("./routes/contact"));
app.use(
  "/staff",
  requireAuth,
  require("./routes/staff")
);

Auth middleware now applies uniformly to every route under /staff/*, instead of being repeated (and occasionally missed) route by route.

Security

A fix that fell out of the cleanup

closed during this rebuild

Pulling auth into a single piece of shared middleware and applying it uniformly across every staff route surfaced a gap: two staff endpoints had been missing the same auth check every neighboring route already enforced. It's the kind of thing a monolith with logic repeated route-by-route makes easy to miss — and the kind of thing a proper refactor catches as a side effect, not a follow-up patch.

Outcome

What changed

google search console — 12-month window
981Total Clicks
14.5KImpressions
6.7%Avg CTR
#18Avg Position
ga4 — aug 20 – sep 16, 2026
178Active Users
245Sessions
48.9%Engagement Rate
7Users via AI Assistant
traffic channels (ga4)
Organic Search 106 users · 59.6%
Direct 55 users · 30.9%
Referral 9 users
AI Assistant 7 users

Four weeks post-launch, AI assistants are already a distinct, trackable referral channel — not a hypothetical one. It's a small number next to organic search, but it's traffic that would have been literally invisible to a site without structured data and an llms.txt for an assistant to draw from in the first place.

GA4 shows 106 organic users against Search Console's 981 clicks over different, overlapping windows — a gap partly explained by attribution differences and deep-linking, and worth continuing to watch rather than reconciling into one number. The homepage still accounts for the large majority of landing traffic (171 of 178 active users); the blog guides (Moving to Chubbuck, Pet-Friendly Apartments) are early and currently ranking page 2–3 — the clearest next target, since they're new pages this platform made possible to ship at all.

View live site ↗
Stack

Full stack