Vite env handling: explicit prefixes only

9734
0

Leaking secrets into the browser bundle is an easy mistake. Vite only exposes env vars with the VITE_ prefix, and I keep that rule strict. I also define a small typed wrapper so components don’t read import.meta.env directly everywhere. The wrapper gives me one place to document required variables and defaults. Another detail: I avoid storing full API base URLs in env when possible and prefer relative paths so deployments are simpler. When env handling is explicit, you reduce ‘works locally’ issues and prevent accidental secret exposure.