Code Comparator

A web change detection system, built during a software engineering internship and still in production.

The company was paying a monthly subscription for a tool that watched competitor and client websites for changes. I proposed building our own. What started as a suggestion became the main project of my internship, and the system has been running on their servers ever since.

Code Comparator control panel listing monitored domains, with a form to add a new monitor

The current version. iProject has since redesigned the interface.

The real problem

Comparing two versions of a web page is trivial. Telling a real change from noise is not. WordPress rewrites version parameters on every load, analytics tools inject timestamps, security plugins rotate tokens. A naive comparator fires alerts constantly, and within two weeks nobody reads them. Most of the work went into a normalisation layer that strips more than a dozen categories of dynamic parameters before anything is compared.

Code Comparator diff view with deleted and modified lines highlighted in red and orange, and a colour legend

Comparing against the right thing

The obvious approach compares every new capture against the original snapshot, which becomes useless within days: it only ever tells you the page differs from where it started. I built a stepped model instead: each capture is compared against the one immediately before it, so the alert answers the question the business actually has, which is what changed this time.

Iteration

The normalisation layer grew one false positive at a time, until it covered more than a dozen categories: versioning, timestamps, cache-busting, tokens and nonces, build numbers, analytics parameters, CDN routing and more. The test suite documents real cases by name: Google Fonts with multiple parameters, OneSignal PHP timestamps, WooCommerce add-to-cart parameters.

How it works

An LCS-based diff engine with a Levenshtein similarity threshold, so a modified line reads as modified rather than as a delete plus an insert. Changes are colour-coded: red for removed, orange for new or changed, green for whitespace only. Three interfaces sit on top: a manual comparison page, a REST endpoint returning a plain status string, and a cron-driven monitor that emails when a watched page moves.

Code Comparator changes page showing the comparison date, the two compared pages and a deleted block of code
Code Comparator diff view of HTML source with deleted and modified lines highlighted

Handing it over

I documented the system so it could run without me: a technical README and a step-by-step deployment checklist for iProject’s CTO, covering email setup, upload and the cron job. It replaced the paid subscription and is still in production. Since then, iProject has redesigned the interface and kept extending the system.

· internal tool, login required

Original developer, internship project · PHP, JavaScript, PHPMailer, cron · 2024–2025