What Day Is It
A site that tells you what today is anywhere in the world — the silly days, the real public holidays, and what happened on this date in history. 250 countries, 500+ pages, refreshed on a schedule.
250 countries · 500+ static pages · Next.js 16 · daily cron
The “national day of…” trivia was scattered across a dozen unreliable pages, and I wanted one clean, fast place that actually covered the whole world.
- 01Eating the CPU budget
- Broke
- The site was burning 72.5% of the monthly free CPU allowance and heading straight for hard shutoffs.
- Why
- Too many pages rendered fresh on every request, a “never cache” header defeated caching, the sitemap re-parsed 30+ MB of data per crawler hit, and every new visitor waited on a blocking location lookup.
- Fix
- Let pages cache and revalidate on a timer, dropped the no-cache header, and read the visitor’s city from a free edge header instead of a slow lookup. The homepage got 79% faster and the main API 97% faster.
- 02The cron that ate 119 countries
- Broke
- For weeks, 119 of the 122 countries with holiday data silently showed none.
- Why
- The weekly refresh called the holiday fetch with no arguments, which defaulted to just Canada/US/Mexico and wiped the output folder first — so every other country’s data got deleted each run, and a forgiving loader hid the gap.
- Fix
- Told the job to fetch all countries explicitly and added a data-quality gate that fails the build if coverage collapses again.
- 03The cache stampede
- Broke
- When the homepage and the wire page asked for the same day’s data at once, they each fired their own redundant fetch instead of sharing one.
- Why
- The cache only stored the finished value after the fetch completed, so callers arriving during the fetch all missed and started their own.
- Fix
- Cache the in-flight promise the moment the first request starts, so everyone waits on the same fetch. (And when the first regression test couldn’t actually catch the bug, I rewrote the test.)
250countries
500+static pages
Evidence before confidence.