← All posts

Teardrop-Caravans and Compact-Campers: two directories, one engine

Two twin sites to compare small camping vehicles, in six languages, built on the same code.

Teardrop-Caravans and Compact-Campers are two directories of small leisure vehicles. The first lists teardrops, those mini caravans shaped like a drop of water, and small caravans. The second covers campervans, van conversions and compact motorhomes.

It is a field I am fond of. I am a camper, and we have already travelled through many European countries camping, or with the equivalent of a teardrop.

Why a directory

These vehicles are built by dozens of small manufacturers, spread over many countries. Each has its own site, its language, its units and its way of presenting a model. Comparing two caravans often means opening ten tabs and converting inches and pounds.

The directory gathers that information in one place and in one format: dimensions, weight, berths, equipment, indicative price and photos. There is nothing for sale, just what you need to compare. Teardrop-Caravans currently holds more than 200 models from 90 manufacturers in 11 countries. Compact-Campers has just opened and is being filled.

Two sites, one codebase

A caravan and a motorhome are not described by the same criteria: one has a dry weight and a rear galley, the other a base vehicle and a fuel type. Rather than writing two sites, the same code runs both.

  • One profile file per site. It sets the name, the logo, the vehicle types, the criteria shown, the filters and the sort orders. Everything else is shared.
  • No shared data. Each site has its own domain, database and photos. Only a link connects them, in the visitor’s language.
  • A single rule for the code: every change must work for both sites. The automated tests run on both profiles.

Six languages

Both sites exist in French, English, German, Dutch, Spanish and Italian.

  • Translated addresses. The models page is called /models, /de/modelle or /it/modelli.
  • Numbers in the local format. 1,050.5 in English, 1.050,5 in German.
  • Readable prices. Each price is entered in the manufacturer’s currency, and the site shows next to it an approximate equivalent in the currency chosen by the visitor.
  • No false duplicates. An entry that is not yet translated is shown in a fallback language, with a notice. That version is not offered to search engines, so that they never see the same text twice.

Simple to host

The site is written in PHP, with no external library and no build step: one stylesheet and a little JavaScript. It runs on ordinary shared hosting, and an update is a plain copy of files.

That simplicity has a cost: everything a library would do is part of the site’s own code, and has to be tested. About 730 automated tests check in particular:

  • that the six languages have exactly the same texts;
  • that the database behaves the same way in development and in production;
  • that no visitor input can alter a query;
  • that a public page never makes more than six queries, whatever the number of entries.

Verified data

A directory is only worth its numbers. A few rules apply to every entry:

  • No invented figure. A value the manufacturer does not publish stays empty.
  • One source per model, preferably the manufacturer’s official page.
  • A review before publication. Each entry is created as a draft and only published after checking.
  • Visitors can correct. Each entry offers a way to report an error, and no correction is applied automatically.

The site also has an API and an MCP connector.

The stack

  • PHP 8, with no dependencies
  • MySQL in production, SQLite in development
  • HTML, CSS and JavaScript with no framework, light and dark theme
  • Shared hosting at OVH

Lire en français →