Zod on the server and the client: the schema you define once and the three ways it breaks in runtime (opens in new tab)
Zod on the server and the client: the schema you define once and the three ways it breaks in runtime 80% of Next.js projects using Zod have the same schema imported from three different contexts. And only one of those three contexts behaves exactly the way Zod promises. Yeah, you read that right. The mental model of "define the schema once and validate everywhere" is true inside the library — but in a real stack with Next.js 16 — Server Actions, edge middleware, and API routes — you're dealin...
Read the original article