T
TanStack3w ago
correct-apricot

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
rare-sapphire3w 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
rare-sapphire3w 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
rare-sapphire
rare-sapphire3w 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
correct-apricot
correct-apricotOP3w ago
Thanks!
adverse-sapphire
adverse-sapphire2w ago
Followed your example, but still cannot get .env to work on the server in production (AWS Amplify).
subsequent-cyan
subsequent-cyan2w 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?