T
TanStack4mo ago
mute-gold

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
sunny-green4mo 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
sunny-green4mo ago
you can check https://github.com/notkamui/miniverso if you want examples
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
sunny-green4mo 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 want
mute-gold
mute-goldOP4mo ago
Thanks!
optimistic-gold
optimistic-gold4mo ago
Followed your example, but still cannot get .env to work on the server in production (AWS Amplify).
sunny-green
sunny-green4mo ago
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

Did you find this page helpful?