Back to portfolio

Migrating 10 property sites to Next.js

Nine WordPress portals and a city map now run from one codebase.

Next.js, TypeScript, WordPressProperty platform migration at VisEngine
Problem
Every new building launch started as a cloned WordPress folder. By portal number nine, schemas, redirect chains, and 3D viewers had drifted across 13 separate directories.
My role
I built the PHP AST audit pipeline, the compiler-gated AI synthesis workflow, and the unified Next.js 16 monorepo runtime at VisEngine.
Solution
Scan 13 legacy folders into deterministic AST manifests, reconcile nine drifted PHP schemas into one 69-field Zod contract and shared S3D runtime, and verify every route with Playwright gates.
Outcome
84% of AI-generated routes passed strict compiler and Playwright checks on the first run. Masterplan wire transfer fell 57.8% (1,053 KiB to 444 KiB, 100/100 Lighthouse), 3D portal TTFB dropped from 549 ms to 134 ms, getFlats XHR from 798 ms to 140 ms, and 5,544-unit genplan Desktop LCP from 6.0 s to 1.1 s.

At VisEngine (client names anonymized as Theme A through Theme I), every new 3D building launch started the same way: copy-paste the previous WordPress folder, rename a few constants, and ship. Fast for launch number two. A maintenance tax by launch number nine.

Before long, one development was split across 13 separate folders: a central masterplan map, nine 3D building portals, and three static promo sites. Fixing a single camera bug meant patching nine repositories. Worse, every mobile visitor paid a 1,250 ms penalty in redirect hops (`301` to `/3d/` to `/en/3d/`) before a single byte of HTML arrived.

I consolidated all 13 legacy folders into one Next.js 16 and React 19 monorepo. By pairing deterministic PHP AST scanners with a compiler-gated AI migration pipeline, the entire port shipped in three and a half weeks.

One masterplan map to connect nine buildings

Previously, clicking a district on the masterplan map kicked the buyer into a completely separate WordPress install with its own scripts, its own cache quirks, and its own copy of the 3D engine. Now, the root masterplan map (`/`) acts as the hub for the entire estate.

From that single map, buyers explore SVG parcel overlays, check road routes between amenities, and see live unit availability across districts. Clicking a parcel steps straight into one of the nine parameterized 3D building portals (`/[theme]/3d`), which connect directly to the floor-stack slicer, the 2D apartment explorer, the 360-degree show-home tours, and the five static editorial routes. All nine buildings now run on one shared S3D spatial engine and one server-side data layer.

Topology diagram showing how the Interactive Masterplan Map (/) connects to the 9 3D Building Portals, Floor and Residence Explorer, 360 VR Show-Home Viewer, and 5 Static Editorial Routes, all powered by one Shared S3D Spatial Runtime and a 69-Field Zod Contract with ISR.
The root masterplan map (/) connects all nine 3D building portals, floor and unit explorers, 360 tours, and static routes over one shared S3D runtime.

Why “paste PHP into ChatGPT” fails by folder number four

Here is the trap with AI code migrations: if you paste raw `ajax.php` files into a prompt one folder at a time, you just get nine incompatible TypeScript apps that recreate the old mess in a newer syntax.

So before generating a single React component, I wrote small PHP AST scanners to inventory every CRM field and config flag across all 13 folders. The scan showed why manual ports had stalled: only 26 apartment fields matched everywhere. Another 42 varied by site (including a currency object immortally spelled `carrency`), and multi-story villa floor plans vanished whenever a portal fell back from its cron cache to live CRM data.

Feeding all nine AST manifests into the model at once let us synthesize one canonical 69-field Zod contract (`FlatSchema`) and a single `formatFlat()` normalizer that reconciles every site quirk and strips unused CRM bloat.

26 shared fields, 42 site-specific quirks and typos, and 1 scheduled import field reconciled into one clean 69-field Zod contract.
Nine drifted PHP schemas reconciled into one 69-field Zod contract.

Let the model write the boilerplate. Let the compiler be the bad cop.

Once the data contract was locked, the AI pipeline generated the route handlers, per-building configs, and React 3D wrappers. Trusting generated code blindly is reckless; making a compiler verify it is fast. Every generated route had to clear three automated gates:

  1. Replay real production apartment payloads from all nine portals through TypeScript strict mode and the 69-field Zod contract.
  2. Open each 3D building in Playwright, scrub the camera, click apartment polygons across angles, and verify that the drawer opens with the right price and floor plan.
  3. If anything failed, pipe the compiler error or Playwright diff straight back to the model to fix its own code.

84% of generated modules passed on the first run. The remaining 16% either fixed themselves on the retry loop or took a quick manual patch.

Data and type checks, 3D browser click tests, and AI auto-fixes producing shipped Next.js routes with an 84% first-try pass rate.
Strict TypeScript checks, Playwright 3D click tests, and automated retry loops kept the AI migration honest.

Stop rewriting JSON files during the buyer's request

In the legacy PHP portals, a cold `getFlats` request called the CRM, wrote JSON files to disk in the middle of the buyer's HTTP request, and sent back 375 KB of raw data. Moving `getFlats` behind a 300-second ISR cache boundary and trimming the payload through `formatFlat()` down to 156.6 KB raw (4.5 KB gzip) dropped endpoint TTFB from 798 ms to 140 ms.

Comparison between legacy request-time PHP file mutations and the Next.js 300-second ISR cache boundary with Zod normalization.
Replacing request-time disk writes with 300-second ISR cut getFlats TTFB by 82.5%.

Trim the wire, and be honest about 40 MiB of JPEGs

The legacy masterplan (`/`) inlined a 248 KB SVG and a 798 KB base64 JPEG straight into uncached PHP HTML. Splitting the map into a preloaded 243 KB WebP and an async SVG overlay with ISR cut root HTML weight by 89.7% (64.3 KB to 6.6 KB) and total page transfer by 57.8% (1,053 KiB to 444 KiB), hitting 100/100 across all four Lighthouse categories.

On the 3D portals, we made a pragmatic call: keep the battle-tested S3D canvas engine and its 120 JPEG flyby frames (~40 MiB per building) untouched so thousands of hand-drawn apartment polygons stayed pixel-accurate, and optimize everything around them. Killing the redirect chain and preloading S3D scripts cut Tower Portal (Theme A) document TTFB from 549 ms to 134 ms. On the 5,544-unit Community Genplan (Theme B), Desktop LCP fell from 6.0 s to 1.1 s and Mobile Total Blocking Time dropped by 1,070 ms.

Before and after the migration

MetricBeforeAfterChange
Document TTFB (Tower Portal)549 ms134 ms4.1× faster + 0 redirects
Inventory XHR (getFlats)798 ms140 ms5.6× faster TTFB
Masterplan wire size (/)1,053 KiB444 KiB57.8% lighter
3D genplan Desktop LCP6.0 s1.1 s5.5× faster (5,544-unit portal)
Masterplan (/) Lighthouse Performance100 / 100 (1.2 s Mobile LCP)100 / 100 (1.0 s Mobile LCP)-0.2 s Mobile LCP & FCP
Tower Portal 3D viewer Speed Index (Mobile / Desktop)7.3 s / 2.6 s4.7 s / 1.4 s-2.6 s Mobile / -1.2 s Desktop
5,544-unit Community Genplan TBT (Mobile / Desktop)3,050 ms / 610 ms1,980 ms / 420 ms-1,070 ms Mobile / -190 ms Desktop
Lighthouse SEO & Accessibility across routes50–80 SEO / 65–85 A11y92–100 SEO / 83–100 A11y+20 to +46 pts SEO
Audit, AI pipeline & Next.js architecture
Vasyl Narbut
Legacy 3D engine & property visuals
The VisEngine project team
Built with
Next.js 15, React 19, TypeScript, Zod, PHP AST tooling and Playwright