TreinGeldTerug: Automated NS Delay Refunds

TreinGeldTerug: Automated NS Delay Refunds


AUTOMATION
automation cloudflare sveltekit backend

NS refunds you when your train is delayed, but only if you file a claim, and only within a limited window. Almost nobody does, which is presumably the point. TreinGeldTerug files them for you.

I built the complete backend for it. Journeys get matched against live delay data, anything past the refund threshold turns into a claim, the claim gets filed and tracked until it resolves, and then the refund is processed and the service fee invoiced. Nobody touches any of it.

The interesting part wasn’t any single one of those steps, it was making the whole chain survive reality. Claims get rejected. Trains get cancelled instead of delayed, which is a different rule. Refunds show up weeks after you filed. If you write it assuming each step succeeds, it works for a month and then quietly stops. So every stage had to be resumable rather than assumed, which is most of the actual work.

It runs on Cloudflare Workers with D1 for storage and scheduled workers driving the claim lifecycle, with SvelteKit on the front. Cost per claim is basically nothing, which matters when the refund itself is often eight euros.

© 2026 Dennis Klappe