How to handle environment variables
I cant seem to find any documentation on environment variables. Are there any recommended ways of doing this?
As of now i am currently using "@t3-oss/env-core" with env-client.ts and env-server.ts, however i feel like Start / Router / Vite offer a better solution for this.
Anyone knows?
6 Replies
rare-sapphire•3w ago
i also use t3-env
fwiw i've been asked to write part of the documentation on using env vars (not published yet it seems)
rare-sapphire•3w ago
GitHub
GitHub - notKamui/miniverso: Self-hostable grouping of mini web app...
Self-hostable grouping of mini web applications for everyday use - notKamui/miniverso
rare-sapphire•3w ago
do take a look at
vite.config.ts
for build time env validation using t3-env
my methods were not refuted, so i can safely assume it's ok
tanstack doesnt have a env validation lib yet, so it's up to you to do it however you wantcorrect-apricotOP•3w ago
Thanks!
adverse-sapphire•2w ago
Followed your example, but still cannot get .env to work on the server in production (AWS Amplify).
subsequent-cyan•2w ago
Maybe defining them through the console?
https://docs.amplify.aws/react/deploy-and-host/fullstack-branching/secrets-and-vars/
Secrets and environment vars - AWS Amplify Gen 2 Documentation
Manage secrets and environment variables across your fullstack branch and local dev environments. AWS Amplify Documentation