DEV Community

Marrakech Transport
Marrakech Transport

Posted on

Build-Time AI: How We Validate 5,000 Prices Across 8 Languages Without a Server

The problem

We run a transport booking site in Morocco — navetteforyou.com. Eight languages, 641 pages, thousands of prices. One wrong number and a customer books a ride expecting 300 MAD when it costs 600.

Manual QA across 5,000+ price points in eight languages is not viable. So we built an AI-assisted build-time validation pipeline.

The pipeline

Every deployment runs three checks before it goes live:

1. Static price extraction

A TypeScript script crawls every generated HTML page and extracts anything that looks like a price: numbers followed by MAD, €, or other currency markers, plus any structured data (JSON-LD offers).

2. Floor price enforcement

Every extracted price is compared against a floor. If any price drops below the minimum — even by one dirham — the build fails. No deploy, no exception.

641 pages × 8 languages
17,113 amounts checked
PASS: no amount under 600 MAD
Enter fullscreen mode Exit fullscreen mode

3. Cross-language consistency

If the English page says a route costs 800 MAD but the French page says 700 MAD, that is a bug. The pipeline flags cross-language price mismatches as warnings.

Why build-time, not runtime

Runtime validation means the error is already live. Build-time validation means the error never ships. The CI pipeline is the last gate before production — if prices are wrong, the deploy is blocked.

This matters more for small businesses than large ones. A large OTA has a customer service team to handle pricing errors. We have five cars and a WhatsApp number.

The AI component

Where does AI fit in? Three places:

  1. Translation draft generation: AI generates initial translations for new content. Human reviewers approve. This is where most cross-language pricing bugs would originate — a model might translate "starting from 800 MAD" as "à partir de 600 MAD" if not constrained.

  2. Structured data generation: AI extracts Schema.org markup from natural-language descriptions. Morocco has no standardized address system, so "the riad near the blue gate in the medina" needs to become machine-readable.

  3. Content validation: The price check script itself uses pattern matching, not LLM inference. But the patterns it validates were originally defined with AI assistance — identifying all the ways a price might appear across eight languages.

Results

Since deploying the pipeline:

  • Zero pricing errors have reached production
  • Build time added: ~4 seconds
  • False positives: 0 (the patterns are deterministic)

The takeaway

AI in production does not have to mean chatbots or recommendation engines. Sometimes it means a 200-line TypeScript script that runs at build time and catches the mistake that would cost you a customer.


navetteforyou.com — Private airport transfers and day trips across Morocco. WhatsApp: +212 701 664 704

Top comments (0)