-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't require client fields #57
Comments
I think this would be a good idea, if we pass a separate flag like for example I am willing to contribute if you need any help |
I am new to typescript, I have tried to implement this in my fork parnavh/t3-env. Can someone have a look and suggest ways to improve the implementation. |
100% second this. @parnavh I think you should just make a PR with that and see what happens. If the core maintainers don't want a server only option in the core package, somebody (am down to jump on this) should add an explainer in the docs and also discuss creating a second package like |
Sure, I'll work on adding the docs and possibly the |
If you want to validate env only on server/client, t3-env is pure overhead for you, a simple zod validation is more than enough, like const env = z.object({
DATABASE_URL: z.string().url(),
OPEN_AI_API_KEY: z.string().min(1),
}).parse(process.env); t3-env is mainly for full-stack framework like NextJS, Nuxt & etc. And it was design to solve two things:
|
I think this might hold true for server environments but we have additional functionalities for the client side like the prefix validation which might benefit client only environments. |
No offense, but I don't really encourage this tho, it usually a bad idea especially for people who are new to the dev industry, where trying to find a tool/package as a silver bullet for solving everything-sh is generally naive. t3-env is literally just adding server-client check on top of zod. In fact, the amount of code you need to write for t3-env versus zod-only approach is nearly identical, if you doesn't need the server-client checking, all you get from t3-env is more package size to download to your project. |
This is might hold true for server only approach where we don't have any client prefix, but we might benefit from this package in client only mode for the validation it provides with the client prefixes. I personally like the server/client only functionality and am ready to contribute and maintain the feature #64 if this is something that would be a good addition to the package. Let me know what you think |
@chungweileong94 open source is about being able to use software as we like. Adding this doesn't harm this project in any way at all and allows devs to use this across all their repos instead of just the ones using frontend. What you're saying comes down to personal opinion. Please see #64 (comment) Also the "overhead" isn't really a good selling point for not having this when we're talking server side. |
@OmgImAlexis I completely understand, my point is that it's best for people who use this package to understand why this tool exists, to know what they are getting, that's it. I always encourage people to look into the OSS source code if they can, so they know how thing works, and if they really need it. It just slightly bothers me when people use this tool on server-only project, where it's literally just a simple wrapper on top of zod. My words could be a bit strong, but I didn't mean anything bad :) |
Yep... this tool exists to validate envs. How someone uses it is really up to the user.
This is personal preference and really shouldn't have any relevance here. If you don't want to use it this way you don't need to. 😄 |
Would be nice if we're just using this for the server if we didn't need to pass in
client
andclientPrefix
.The text was updated successfully, but these errors were encountered: