Notifio is a desktop app that watches listing searches and emails you when something new appears. The website at notifio.app sells it, serves the installers and holds the licence database. I wanted to know what that website does when its configuration is wrong, so I counted every environment name it reads and then built the objects that read them with the value missing.

This is a tangent on an earlier post about working out your site URL once. That one was about our sister app PubTrivia. Notifio did not take that advice, and the numbers below are what that looks like.

Sixteen names, and a file that lists exactly those

A grep for process.env. across server/src and server/scripts finds nineteen names. Three of them belong to the framework or the toolchain (NODE_ENV, NEXT_RUNTIME, PLAYWRIGHT_BROWSERS_PATH). The other sixteen are ours: the database URL, two Stripe values, two Resend values, two Upstash values, four R2 values, two Sentry DSNs, the public app URL, a Managed Payments switch and an IndexNow key.

server/.env.example lists exactly those sixteen. It has not drifted, which is better than I expected from a file last touched on 14 September.

The odd part is how it survives. Both server/.gitignore and the root .gitignore contain the rule .env*, and both example files match it. I asked git:

$ git check-ignore --no-index -v server/.env.example app/.env.example server/.gitignore:2:.env* server/.env.example .gitignore:37:.env* app/.env.example 

They are tracked only because they were committed on day one, before the ignore rule arrived two days later. Git keeps tracking a file after a pattern starts matching it, so edits to them still show up. A new .env.test.example would be silently ignored. The fix is a one line negation, !.env.example, and I have not made it, so this is a description and not a patch.

One variable, fourteen fallbacks

NEXT_PUBLIC_APP_URL is the origin of the site. Everything that builds an absolute URL needs it: the sitemap, robots.txt, the structured data, the Stripe redirects. Here is every place it has a fallback:

12 ?? "https://notifio.app" 2 ?? "http://localhost:3001" 1 ?? DEFAULT_SITE (the IndexNow script) 

Fourteen in the app, typed out by hand. Twelve say production and two say localhost, and the two that say localhost are the two checkout routes, the ones that hand Stripe a return URL. So on a machine with the variable unset, the sitemap and robots.txt would claim to be the live site, while a test checkout would send you to port 3001. Each choice is defensible. The point is that nobody chose it once.

What a missing name does

I constructed each client with the value undefined, in a throwaway script against the installed packages, no network involved.

Name What happens
RESEND_API_KEY new Resend(undefined) throws "Missing API key". Two modules do this at top level, so it fails at import.
STRIPE_SECRET_KEY new Stripe(undefined) throws "Neither apiKey nor config.authenticator provided", also at import.
STRIPE_WEBHOOK_SECRET constructEvent throws a TypeError about the key argument. It is inside a try, so the caller gets a 400.
UPSTASH_REDIS_REST_URL The client constructs and prints three warnings. The first ratelimit.limit() throws Failed to parse URL from /pipeline.
DATABASE_URL postgres(undefined) constructs happily and falls back to local defaults. The first query fails.
R2_* The download route checks all three and answers 503 "Download is temporarily unavailable."
MANAGED_PAYMENTS_ENABLED Compared with === "true", so anything else, including a typo, is off.
INDEXNOW_KEY The script exits with a message that says which command creates one.

There are two families here. Stripe and Resend refuse to exist without a key, which means a bad deploy fails loudly and early. Redis and Postgres construct fine and fail on first use, which means the failure arrives with a request attached. And the Redis one matters, because /api/validate awaits ratelimit.limit() outside any try block, so a missing Upstash variable turns every licence check into an unhandled 500 rather than a clean error. The download page shows the good pattern by contrast: it validates its four R2 names and degrades to a 503 with a sentence a person can read.

I did not test RESEND_WEBHOOK_SECRET in this pass, so this is ten of the sixteen, not all of them.

What I would change

  1. One module exports the site URL and every file imports it, with the fallback following NODE_ENV as in the PubTrivia post.
  2. A negation line so example files are properly tracked.
  3. A try around the rate limiter in the three routes that call it.

The site is live if you want to poke at the parts that do not depend on a missing variable: pricing, download, help.