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
sunny-green•4mo 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)
sunny-green•4mo ago
GitHub
GitHub - notKamui/miniverso: Self-hostable grouping of mini web app...
Self-hostable grouping of mini web applications for everyday use - notKamui/miniverso
sunny-green•4mo 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 wantmute-goldOP•4mo ago
Thanks!
optimistic-gold•4mo ago
Followed your example, but still cannot get .env to work on the server in production (AWS Amplify).
sunny-green•4mo 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