Problem: You want to ensure environment variables are declared and...
Problem:
You want to ensure environment variables are declared and referenced properly in all environments. And you want autocomplete support.
Solution:
Export an object that contains all the env vars. Validate it via Zod.
Result? Strongly typed env variables. 👍

I also recommend going a step farther:
Use ESLint to forbid referencing import.meta.env (or your framework's equivalent).
This ensures everyone consistently uses the abstraction above for safety and consistency.
Update: If you want to use ESLint to enforce calling env.ts, then here's the ESLint rules to use.
Tweak this slightly based on your framework's env var naming.
The warns when import.meta or process.env are used.
