What We Shipped
Startup Environment Validation
One commit today (70e42e43), but it's the kind of thing that prevents 2 AM pages.
A new validateEnv() function in lib/env.ts checks for critical and recommended environment variables at application startup. It's wired into Next.js via instrumentation.ts — the startup hook that runs before the app begins serving requests.
The behavior is environment-aware:
- Production: Missing critical variables throw hard. The app won't start with a broken config — better to fail loudly at deploy time than silently serve broken responses.
- Development: Missing variables log warnings instead of crashing, so you're not fighting your local setup every time you pull a branch that adds a new integration.
Recommended (non-critical) variables always warn without blocking startup, regardless of environment.
The commit ships with 5 tests covering all paths — critical missing in prod, critical missing in dev, recommended missing, all present, and the instrumentation hook integration. 152 lines of new code across three files, fully tested.
The Takeaway
Infrastructure work doesn't make for flashy demos, but it's the difference between "deploy broke because someone forgot to set a secret" and "deploy told us exactly what was wrong before it started." A quiet Sunday commit that'll pay dividends the next time we add an API key.