Skip to content
mattix

zitertarwein.nl

TypeScript, React · Cloudflare Worker · live at zitertarwein.nl · MIT, data ODbL · mattijsf/zitertarwein.nl

Type a product and see whether it contains wheat, with a source link. The site is in Dutch. Wheat-free is not the same as gluten-free: rye and barley contain gluten too.

Terminal window
git clone https://github.com/mattijsf/zitertarwein.nl.git
cd zitertarwein.nl
pnpm install
pnpm dev
zitertarwein.nl on a phone: the search box with sojasaus typed in and the answer Ja, tarwe, with a source link

Result for sojasaus (soy sauce).

A search tries these in order:

  1. curated list, ~310 products
  2. Open Food Facts import, ~4,000 products
  3. live Open Food Facts search
  4. Google link

The curated list is src/data/products.ts. Each entry has a status (yes, no or check), an explanation in Dutch and a source: Voedingscentrum, the Dutch coeliac society or Open Food Facts. The import, src/data/off-products.json, is generated from Open Food Facts: the most popular Dutch products with an ingredient list, plus extra products in sauces, soups, biscuits and sweets. It’s loaded lazily as a separate chunk.

Names are normalized (case, accents, punctuation, spaces) before matching, so “coca cola” finds “Coca-Cola”. Typos match through a bounded edit distance. If nothing matches, the site queries the Open Food Facts API and uses the first result with ingredients. Otherwise it shows a Google link with a prefilled query.

src/lib/rules.json has the regexes that decide whether an ingredient list contains wheat. The live search and the Python import both use it.

{
"wheatText": "[\\w-]*(?:tarv?we|wheat|weizen|\\bbl[eé](?![\\wÀ-ÿ])|froment|durum|semol|spelt|khorasan|kamut|seitan|bulgur|couscous)[\\w-]*",
"notWheat": "buc[kh]w(?:heat|eizen)[\\w-]*|bl[eé]\\s+noir|sans\\s+bl[eé]|(?:wheat|weizen|tarwe)[ -]?(?:free|frei|vrij)\\b"
}

Labels in Dutch supermarkets can be in Dutch, English, German or French, hence the four languages. notWheat is applied first and strips buckwheat, blé noir and “wheat-free”. A wheat word left in the ingredients or the allergen tags means wheat.

generate.py builds the import from one or more modules in sources/, each with a read(path) function. There are two: the Open Food Facts Parquet dump (about 8 GB, queried with DuckDB) and CSV exports from a supermarket. On duplicate names the first source wins.

Terminal window
python3 generate.py off=food.parquet

refresh-data.sh downloads, imports and commits. It runs monthly from cron, and every commit on main deploys.

The camera button scans a barcode and looks it up on Open Food Facts. The site is a PWA and works offline.

scripts/build-seo.ts generates a static page per product under /p/, an A–Z index and a sitemap, so a search like “zit er tarwe in hummus” can hit a product page directly.

pnpm check runs ESLint, Prettier, tsc, the tests and knip (unused files, exports and dependencies). scripts/check-escape-hatches.ts fails when the number of any types, as casts or eslint-disable comments goes up. lefthook runs the same checks on pre-push.

No trackers or cookies. Older designs of this site.