I'm just now realizing this behavior about nextjs env vars here, which is different from how nodejs apps are usually set up:
Note: .env files should be included in your repository, and .env*.local should be in .gitignore, as those files are intended to be ignored. Consider .local files as a good place for secrets, and non-local files as a good place for defaults.
So I'm thinking of restricting myself to using a secret available only at build-time, to be used inside a "backend" /api route.
But do /api routes even behave like true backends? Since nextjs is SSR only when it has to be (?), I presume this /api code can also end up in the browser, therefore exposing the secret? Is there a way to force code to only run server-side and not in-browser? I am new to SSR concepts. My "real" backend won't be up for a while. This is not a hugely important secret, but still. Thx.