Live data from Hacker News

Zod v4 Beta

v4.zod.dev

1–10 of 48 posts

Re: Zod v4 Beta

#3
I only use Zod in a single library, so my experience with it is pretty minimal. One thing I have really enjoyed with it is the low maintenance.

So, when I saw this post and read the first few paragraphs, I was filled with dread for having to do yet another major dependency update. Reading of all the improvements- surly the ‘breaking changes’ list must be massive.

Having read the full article, it seems like the breaking changes have been kept within reason. One major improvement that stands out to me is the improved Recursive types support, but there is certainly any number of improvements for others to be excited about.

The thing I enjoyed most is that excitement of the Arthur really shines throughout the whole article. I’m so thankful this library exists and is being lovingly maintained by someone who is genuinely interested in it.

Re: Zod v4 Beta

#4
We stuck with Yup and ignored Joi, Zod and god knows what else has come down the pipeline since. Rather than wasting time upgrading, we've instead built useful features.

That said, we are slowly phasing out our React frontend for one of our apps page by page and replacing it with what we use over the rest of apps: Phoenix + Liveview. The changeset system for validations has proven itself time and time again to both be fast but also to handle many of the curly validation problems we might have. It also has barely changed since its release.

If you have a disciplined frontend team then you might be able to make it work. They have to be able to ignore the latest shiny thing that has come along, but if you don't then you'll have a team that is busy constantly upgrading to the latest shiny library rather than getting anything done.

Re: Zod v4 Beta

#5
This is awesome, bundle size has been my number one issue preventing me from trying out Zod as v3 shipped with validations that were unnecessary for frontend use but weren't able to be treeshaken.

Re: Zod v4 Beta

#6
My team has been building a greenfield SaaS app for the past ~9 months and when we started, we went all in on Zod and so far the experience has been pretty fantastic. Zod is very intuitive to use and being able to generate typescript types off the schemas is very useful. Though with that said if you're already using Yup or Joi I don't recommend switching as there's just not enough of a reason to switch over.

Re: Zod v4 Beta

#8
> Zod v3.0 was released in May 2021...

v3 didn't last four years. Can we expect much different from v4?

If you're migrating your zod 3 code, I'd migrate to something more stable and long-lived than v4 is likely to be -- unless you want to be going through it all again in a few years (and yet again a few years after that, etc).

I don't blame the maintainers (I assume they don't have a fat support and maintenance contract)

But developers need to go in with their eyes open when it comes to adopting these throw-away libraries and frameworks.

Re: Zod v4 Beta

#9
post #8

> Zod v3.0 was released in May 2021... v3 didn't last four years. Can we expect much different from v4? If you're migrating your zod 3 code, I'd migrate to something more stable and long-lived than v4 is likely to be -- unless you want to be going through it all again in a few years (and yet again a few years after that, etc). I don't blame the maintainers (I assume they don't have a fat support and maintenance contr…

> But developers need to go in with their eyes open when it comes to adopting these throw-away libraries and frameworks.

For contrast: My entire company is less than 4 years old and any code from 6 months ago feels old because things (in a business requirements sense) change so fast. Zod lasting 3 years is fine.

Although I do wish v4 came a little sooner because we just started using Zod a few months ago.

Re: Zod v4 Beta

#10
post #5

This is awesome, bundle size has been my number one issue preventing me from trying out Zod as v3 shipped with validations that were unnecessary for frontend use but weren't able to be treeshaken.

I do wonder if it might have fixed the type complexity issue that has prevented me from exporting Zod schemas from a library, but I suppose I could try finding this out later
Post reply on HN