{"success":true,"data":{"web":[{"url":"https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1","title":"Zod v4 got 17x Slower than v3 - DEV Community","description":"For a non-trivial schema, Zod v4 is now 8x faster than before. But when you create a schema and use it just once (a common pattern in React ...","position":1,"markdown":"Hey everyone! 👋\n\nI'm [Dmitry](https://x.com/dzakh_dev), the creator of [Sury](https://dev.to/dzakh/welcome-sury-the-fastest-schema-with-next-gen-dx-5gl4)—the fastest schema library out there. If you’re a fan of [Zod](https://v4.zod.dev/) (and who isn’t?), you’ll want to read this. Today, I want to share some surprising findings about Zod v4’s performance, what it means for you, and how to avoid the pitfalls.\n\n## Zod v4: 17x Slower? Not Quite, But...\n\nLet’s start with a little clickbait:\n\n**Zod v4 became 17 times slower, and nobody noticed 🙈**\n\nThis is 100% true, but of course, that’s not the whole story. Let’s dig in.\n\nRecently, while prepping for the big [Sury v10](https://dev.to/dzakh/welcome-sury-the-fastest-schema-with-next-gen-dx-5gl4) release, I decided to rerun my benchmarks with [Zod v4](https://v4.zod.dev/). The results? Fascinating.\n\n- For a non-trivial schema, Zod v4 is now **8x faster** than before.\n- **But** when you create a schema and use it just once (a common pattern in React components), performance drops significantly—down to about **6 ops/ms**.\n\nYou might think, “6 ops/ms is still fast!” But in UI-heavy apps, every millisecond counts. If you’re using Zod in your React components, this could mean a noticeable performance hit.\n\n### Schema from the benchmark\n\n```\nimport { z } from \"zod\"; // 13.5 kB (min + gzip)\n\nconst zodSchema = z.object({\n number: z.number(),\n negNumber: z.number(),\n maxNumber: z.number(),\n string: z.string(),\n longString: z.string(),\n boolean: z.boolean(),\n deeplyNested: z.object({\n foo: z.string(),\n num: z.number(),\n bool: z.boolean(),\n }),\n});\n```\n\nEnter fullscreen modeExit fullscreen mode\n\n## What Changed in Zod v4?\n\nMy hunch was that Zod v4 started using `eval` (or, more precisely, JIT compilation via `new Function`) for validation. This isn’t a bad thing — libraries like [TypeBox](https://github.com/sinclairzx81/typebox), [ArkType](https://arktype.io/), and even [Sury](https://github.com/DZakh/sury) use similar techniques for speed.\n\nBut there’s a tradeoff:\n\n- **Schema creation** becomes slower (because of the JIT compilation step).\n\nAlthough, it's not a problem for most users, because:\n\n- **Validation** becomes much faster (once the schema is compiled and used multiple times).\n\nZod v3 was already a bit slow at schema creation, but v4 takes it further. If you’re creating schemas on the fly (again, think React), you might feel the slowdown.\n\n## Is Eval/JIT Bad? Not Really.\n\nThere’s a common myth that `eval`/`new Function` is always slow or unsafe. In reality, when used carefully, it can unlock incredible performance. [Sury](https://github.com/DZakh/sury) leans heavily on JIT compilation and is still almost on par with [Valibot](https://valibot.dev/), which is designed for quick initialization.\n\nHere’s a quick comparison (min + gzip):\n\n| Library | Import Size | Parse (same schema) | Create & Parse Once |\n| --- | --- | --- | --- |\n| [Sury](https://github.com/DZakh/sury) | 4.27 kB | 94,828 ops/ms (JIT only) | 166 ops/ms |\n| [Zod v3](https://github.com/colinhacks/zod) | 13.5 kB | 1,191 ops/ms (no JIT) | 93 ops/ms |\n| [Zod v4](https://v4.zod.dev/) | 13.5 kB | 8,437 ops/ms | 6 ops/ms |\n| [Valibot](https://valibot.dev/) | 1.23 kB | 1,721 ops/ms (no JIT) | 287 ops/ms |\n| [TypeBox](https://github.com/sinclairzx81/typebox) | 22.8 kB | 99,640 ops/ms (only assert support) | 111 ops/ms |\n| [ArkType](https://arktype.io/) | 45.8 kB | 67,552 ops/ms | 11 ops/ms |\n\n> Full comparison in [Sury’s README](https://github.com/DZakh/sury#comparison)\n\n## What Should Zod Users Do?\n\nIf you’re using Zod in a backend or for long-lived schemas, you’ll love the new speed. But if you’re creating schemas dynamically (like in React components), you might want to benchmark your app or consider alternatives.\n\nZod v4 does offer both normal and JIT-optimized parsing, so you might be able to tweak your usage. But it’s worth being aware of the tradeoffs.\n\nAlso, there should be a way to disable JIT compilation for those who don't want it. I don't know the exact API or whether it's exposed, but I've seen that this option exists in Zod's internals.\n\n## Enter Sury: The Fastest Schema Library\n\nOkay, shameless plug time! 😅\n\nI built [Sury](https://dev.to/dzakh/welcome-sury-the-fastest-schema-with-next-gen-dx-5gl4) to solve exactly these problems:\n\n- **Blazing fast** parsing and validation (thanks to JIT)\n- **Tiny bundle size** and tree-shakable API\n- **Great TypeScript inference** and developer experience\n- **Standard Schema** and **JSON Schema** support out of the box\n- **Declarative transformations** and automatic serialization\n\nSury is already used in production by many companies and is compatible with tools like tRPC, TanStack Form, Hono, and more.\n\nHere’s what using Sury looks like:\n\n```\nimport * as S from \"sury\";\n\nconst filmSchema = S.schema({\n id: S.bigint,\n title: S.string,\n tags: S.array(S.string),\n rating: S.union([\"G\", \"PG\", \"PG13\", \"R\"]),\n});\n// On hover: S.Schema<{ id: bigint; title: string; tags: string[]; rating: \"G\" | \"PG\" | \"PG13\" | \"R\"; }, Input>\n\ntype Film = S.Output;\n// On hover: { id: bigint; title: string; tags: string[]; rating: \"G\" | \"PG\" | \"PG13\" | \"R\"; }\n\nS.parseOrThrow(\n {\n id: 1n,\n title: \"My first film\",\n tags: [\"Loved\"],\n rating: \"S\",\n },\n filmSchema\n);\n// Throws S.Error with message: Failed at [\"rating\"]: Expected \"G\" | \"PG\" | \"PG13\" | \"R\", received \"S\"\n\n// Or do it safely:\nconst result = S.safe(() => S.parseOrThrow(data, filmSchema));\nif (result.error) {\n console.log(result.error.reason);\n // Expected \"G\" | \"PG\" | \"PG13\" | \"R\", received \"S\"\n}\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nAnd yes, Sury also uses JIT under the hood, but with a focus on both creation and validation speed.\n\n## Final Thoughts\n\n- Zod v4 is a fantastic library, and [Colin](https://x.com/colinhacks) (the author) did an amazing job supporting both normal and JIT-optimized parsing.\n- If you care about performance—especially in dynamic or UI-heavy scenarios — benchmark your usage.\n- If you want the fastest schema validation, smallest bundle, and next-gen DX, give [Sury](https://github.com/DZakh/sury) a try.\n(And if you like it, a GitHub star would make my day! ⭐)\n\nThanks for reading! If you have questions, feedback, or want to see more benchmarks, let me know in the comments or ping me on [X](https://x.com/dzakh_dev). See you soon with more updates! 🚀\n\n[![profile](https://media2.dev.to/dynamic/image/width=64,height=64,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F3774%2F02d4162c-978f-4471-9d39-b2928cfb9e24.png)\\\\\nSentry](https://dev.to/sentry) Promoted\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=262863)\n\n[![Sentry image](https://media2.dev.to/dynamic/image/width=775%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FFEPDyO5.png)](https://sentry.io/welcome/?utm_source=devto&utm_medium=paid-community&utm_campaign=brand-fy27q1-quitbuggin&utm_content=static-ad-qb-thumb-trysentry&bb=262863)\n\n## [TIL I don’t have to bug out](https://sentry.io/welcome/?utm_source=devto&utm_medium=paid-community&utm_campaign=brand-fy27q1-quitbuggin&utm_content=static-ad-qb-thumb-trysentry&bb=262863)\n\n[Read more →](https://sentry.io/welcome/?utm_source=devto&utm_medium=paid-community&utm_campaign=brand-fy27q1-quitbuggin&utm_content=static-ad-qb-thumb-trysentry&bb=262863)\n\nRead More\n\n\n![pic](https://media2.dev.to/dynamic/image/width=256,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png)\n\n[Create template](https://dev.to/settings/response-templates)\n\nTemplates let you quickly answer FAQs or store snippets for re-use.\n\nSubmitPreview [Dismiss](https://dev.to/404.html)\n\nCollapseExpand\n\n[![katriel profile image](https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F726855%2F69d5083a-b3be-48d9-b951-0ed15c72658f.jpg)](https://dev.to/katriel)\n\n[Katriel](https://dev.to/katriel)\n\nKatriel\n\n\n\n[![](https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F726855%2F69d5083a-b3be-48d9-b951-0ed15c72658f.jpg)\\\\\nKatriel](https://dev.to/katriel)\n\nFollow\n\n- Email\n\n\n[katriel.developer@gmail.com](mailto:katriel.developer@gmail.com)\n\n- Joined\n\n\nOct 15, 2021\n\n\n• [Jul 29 '25](https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1#comment-307ao)\n\nDropdown menu\n\n- [Copy link](https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1#comment-307ao)\n- Hide\n\n- [Report abuse](https://dev.to/report-abuse?url=https://dev.to/katriel/comment/307ao)\n\nDoes that mean, for example, in serverless scenarios where you gotta initializate the library and schemas each time, sometimes even each request. Valibot, Sury and Zod V3 are the best ones?\n\nCollapseExpand\n\n[![dzakh profile image](https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F988236%2Fbe515a70-aadf-48ea-ba1f-e92410a78528.jpeg)](https://dev.to/dzakh)\n\n[Dmitry Zakharov](https://dev.to/dzakh)\n\nDmitry Zakharov\n\n\n\n[![](https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F988236%2Fbe515a70-aadf-48ea-ba1f-e92410a78528.jpeg)\\\\\nDmitry Zakharov](https://dev.to/dzakh)\n\nFollow\n\nBuild fastest tools with best DX 🫡\n\n\n- Location\n\n\n\nGeorgia, Batumi\n\n\n- Work\n\n\n\nEnvio\n\n\n- Joined\n\n\nDec 11, 2022\n\n\n• [Aug 5 '25](https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1#comment-30b0l)\n\nDropdown menu\n\n- [Copy link](https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1#comment-30b0l)\n- Hide\n\n- [Report abuse](https://dev.to/report-abuse?url=https://dev.to/dzakh/comment/30b0l)\n\nYes. For this specific usecase I'd even say Typia is the best tool.\n\nAre you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's [permalink](https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1#).\n\n\nHide child comments as well\n\nConfirm\n\n\nFor further actions, you may consider blocking this person and/or [reporting abuse](https://dev.to/report-abuse)\n\n[![profile](https://media2.dev.to/dynamic/image/width=64,height=64,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F2584%2F76d5831f-7acd-4123-8083-00818e48de9b.png)\\\\\nDraft.dev](https://dev.to/draft) Promoted\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=261775)\n\n[![Graphite image](https://media2.dev.to/dynamic/image/width=775%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FYPX9MWh.png)](https://graphite.com/l/stacked-prs-guide?utm_source=draft-dev&bb=261775)\n\n## [Stop Shipping Massive PRs](https://graphite.com/l/stacked-prs-guide?utm_source=draft-dev&bb=261775)\n\nBig pull requests slow everything down. This guide explains stacked pull requests and shows how to roll them out without breaking your workflow or starting a Git rebase war. Written for engineering managers who just want reviews to move faster.\n\n[Read more](https://graphite.com/l/stacked-prs-guide?utm_source=draft-dev&bb=261775)\n\n👋 Kindness is contagious\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=236877)\n\nx\n\nExplore this **insightful** write-up, celebrated by our thriving DEV Community. **Developers everywhere** are invited to contribute and elevate our shared expertise.\n\nA simple \"thank you\" can brighten someone’s day—leave your appreciation in the comments!\n\nOn DEV, **knowledge-sharing fuels our progress** and strengthens our community ties. Found this useful? A quick thank you to the author makes all the difference.\n\n### [Okay](https://dev.to/enter?state=new-user&bb=236877)\n\n![DEV Community](https://media2.dev.to/dynamic/image/width=190,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png)\n\nWe're a place where coders share, stay up-to-date and grow their careers.\n\n\n[Log in](https://dev.to/enter?signup_subforem=1) [Create account](https://dev.to/enter?signup_subforem=1&state=new-user)\n\n![](https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg)![](https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg)![](https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg)![](https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg)![](https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg)","metadata":{"head-cached-at":"1774621837","twitter:creator":"@dzakh_dev","search-script":"https://assets.dev.to/assets/Search-b977aea0f2d7a5818b4ebd97f7d4aba8548099f84f5db5761f8fa67be76abc54.js","og:site_name":"DEV Community","og:url":"https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","twitter:widgets:new-embed-design":"on","environment":"production","viewport":"width=device-width, initial-scale=1.0, viewport-fit=cover","og:type":"article","keywords":"zod, typescript, schema, validation, software, coding, development, engineering, inclusive, community","og:image":"https://media2.dev.to/dynamic/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cmh41mb9tk2coludfgu.png","forem:domain":"dev.to","ogDescription":"A surprising finding about Zod v4’s performance, what it means for you, and how to avoid the pitfalls.","user-signed-in":"false","twitter:title":"Zod v4 got 17x Slower than v3 🚦","og:title":"Zod v4 got 17x Slower than v3 🚦","title":"Zod v4 got 17x Slower than v3 🚦 - DEV Community","application-name":"dev.to","twitter:image:src":"https://media2.dev.to/dynamic/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cmh41mb9tk2coludfgu.png","twitter:description":"A surprising finding about Zod v4’s performance, what it means for you, and how to avoid the pitfalls.","language":"en","forem:name":"DEV Community","last-updated":"2026-03-27 14:30:37 UTC","description":"A surprising finding about Zod v4’s performance, what it means for you, and how to avoid the pitfalls. Tagged with zod, typescript, schema, validation.","ogUrl":"https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1","ogTitle":"Zod v4 got 17x Slower than v3 🚦","theme-color":["#ffffff","#000000"],"twitter:site":"@thepracticaldev","og:description":"A surprising finding about Zod v4’s performance, what it means for you, and how to avoid the pitfalls.","apple-mobile-web-app-title":"dev.to","csrf-token":"yLQSk-6A0E_VyCZakR76zGAbezEP50ATzC3zCMaYvJarFmNzzaTejnJy-MNAuL9RzgL05V9wsn_HIS7VSFTpyA","twitter:card":"summary_large_image","forem:logo":"https://media2.dev.to/dynamic/image/width=512,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png","csrf-param":"authenticity_token","ogImage":"https://media2.dev.to/dynamic/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cmh41mb9tk2coludfgu.png","ogSiteName":"DEV Community","favicon":"https://media2.dev.to/dynamic/image/width=32,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png","scrapeId":"019d3953-5db3-7406-9362-e58443a2fd8e","sourceURL":"https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1","url":"https://dev.to/dzakh/zod-v4-17x-slower-and-why-you-should-care-1m1","statusCode":200,"contentType":"text/html; charset=utf-8","proxyUsed":"basic","cacheState":"hit","cachedAt":"2026-03-29T11:20:40.012Z","creditsUsed":1}},{"url":"https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4","title":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","description":"We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, ...","position":2,"markdown":"[Skip to Main Content](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4#content)\n\n# Lessons from Upgrading a Large TypeScript App to Zod 4\n\n![](https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6Mjg0LCJoZWlnaHQiOjI4NCwiZml0IjoiY292ZXIifSwid2l0aE1ldGFkYXRhIjp0cnVlLCJ0b0Zvcm1hdCI6IndlYnAiLCJ3ZWJwIjp7InF1YWxpdHkiOjgwfX19?signature=5aea842fc686abc5e45c19aab94d4c34a5a774d90d7ae81755c235e62416a167)\n\n- [Home](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Articles](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Lessons from Upgrading a Large TypeScript App to Zod 4](about:blank#hero)\n\n[Subscribe (opens in a new window)](http://eepurl.com/gtHqsj)\n\nShare\n\n- [Share this page](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Share this page](http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Post this page](https://x.com/intent/tweet?text=We%20recently%20upgraded%20a%20large%20application%20from%20Zod%203%20to%204.%20The%20performance%20improvements%20are%20great%20and%20apart%20from%20one%20or%20two%20things%2C%20the%20migration%20was%20straightforward.%20Here%20are%20a%20few%20things%20we%20learned%20along%20the%20way.%20https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n\n[![Solomon Hawk](https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6IlNvbC1pY29uLTIwMjAuanBnIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjo4MCwiaGVpZ2h0Ijo4MCwiZml0IjoiY292ZXIifSwid2l0aE1ldGFkYXRhIjp0cnVlLCJ0b0Zvcm1hdCI6IndlYnAiLCJ3ZWJwIjp7InF1YWxpdHkiOjgwfX19?signature=4e6e204a4610d0bc208fe313eee5f922733a86428a341002df3d300fdd82786b)](https://www.viget.com/about/team/shawk/)\n\n[Solomon Hawk](https://www.viget.com/about/team/shawk/), Development Director\n\nArticle Categories:\n[#Code](https://www.viget.com/articles/?category=code#results), [#Front-end Engineering](https://www.viget.com/articles/?category=front-end-engineering#results), [#Back-end Engineering](https://www.viget.com/articles/?category=back-end-engineering#results), [#Performance](https://www.viget.com/articles/?category=performance#results), [#Tooling](https://www.viget.com/articles/?category=tooling#results)\n\nPosted on\n\nOctober 15, 2025\n\n\n- [Share](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Share](http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Post](https://x.com/intent/tweet?text=We%20recently%20upgraded%20a%20large%20application%20from%20Zod%203%20to%204.%20The%20performance%20improvements%20are%20great%20and%20apart%20from%20one%20or%20two%20things%2C%20the%20migration%20was%20straightforward.%20Here%20are%20a%20few%20things%20we%20learned%20along%20the%20way.%20https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n\nWe recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way.\n\n\nWerecentlyupgradedalargeapplicationfromZod3to4.Theperformanceimprovementsaregreatandapartfromoneortwothings,themigrationwasstraightforward.Hereareafewthingswelearnedalongtheway.\n\n## `.pipe(..)` is much stricter [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#pipe-is-much-stricter \"Direct link to .pipe(..) is much stricter\")\n\nIf you make liberal use of `.pipe()` as a way to compose schemas then, like us, you might find yourself staring at an issue like:\n\n`The types of _zod.input are incompatible between these types: `\n\nIf you have code like:\n\n```ts\nconst schema = z.object({\n\tq: z.string(),\n\tsort: z\n\t\t.string()\n\t\t.transform((value) => value.split(':'))\n\t\t.pipe(someOtherSchemaExpectingValidSortParam)\n});\n```\n\nA [few](https://github.com/colinhacks/zod/issues/4778) [different](https://github.com/colinhacks/zod/issues/4800) folks have started up discussions around the change. As Colin [points out](https://github.com/colinhacks/zod/issues/4800#issuecomment-3029123852), “Zod schemas aren't contravariant in their input type” which is an intentional choice but it does create some edge cases like this.\n\nThe change to make `.pipe()` stricter in v4 is “intentional to fix unsoundness in v3”. It should help us more easily discover if we’re creating pipelines that may not behave as expected but it also comes with the need for workarounds while we migrate our projects to v4.\n\n| ⚠️ **What does “Zod schemas aren't contravariant in their input type” mean?** |\n| --- |\n| That’s an entire other separate blog post, I’m afraid. If you’d like to explore further I’d start with [the wikipedia article on Contravariance](https://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29), brush up on your [Liskov Substitution Principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle), and then look back at the classic [Animal > Dog example](https://www.google.com/search?q=typescript+contravariant+over+input&sca_esv=c5a64250820e60ea&sxsrf=AE3TifMl2FTYxQUIYfp1TwyPGWJWgHgZmQ%3A1752864809079&ei=KZh6aIDSBMPoptQP_uHriQE&ved=2ahUKEwiahvipiseOAxWWhIkEHbcTOa0Q0NsOegQIIxAB&uact=5&sclient=gws-wiz-serp&udm=50&fbs=AIIjpHxU7SXXniUZfeShr2fp4giZ1Y6MJ25_tmWITc7uy4KIeiAkWG4OlBE2zyCTMjPbGmMU8EWskMk2JSE__efdUJ3xRFvZ0M2vJLB0hUMk5HOE2JYHbn8EkAxflxA6nxAnoTjk4oAEbLx_kIot3fSUrLREcfN9LZ7Q2YE3_jllCcF3SYZ4e2-CUHrZASnm8ODfrjL9RpOPmwh-3ZUt-RD_JH0n4gHbUw&aep=10&ntc=1&mtid=3Zh6aKjdFNC0ptQPnJDhsQE&mstk=AUtExfD6bWDo6E4ADaD7ReVdfS8pWdaoy1QmA8aRS7AclnsG2f4Bx_CatmR-A5RSWL2d4FkOfbVfUFRldw23od5T5fNCB9hhtx3nJwl7AEb4etPX-F-8dJAOGImxEkbwUEqe7FgyH9HaMArR20eAoPDuWbdbjpNRi3ERLdkimtMPq86d2CFpFljxRACPfCoGF4tlmxXxD_8uRQAKEvLTcdOP-kzZsYOMq-Hulgxbo0HhlYre7K4OKhtg1waUw3NkaI0EVGuAALGPqUCSIh-M2WoT94VkPweDIpKD39xGwo1Fsf2b91rygKoodXj-Zq4M2DMTgfnty1oReYOuGty8q-rICwcPfgoRPhwWlcYpQnzkKYrTwYTSLU8NsLAyQyzhUc9CQy_NSr-74LMWrb7iPjJG3Fvmddude9GA02NhjLIL24OcIOKJ5XxinWmzR3ftEVNnQz6xzVwRVi4&csuir=1) which should make a bit more sense. |\n\n### Workaround 1: Return `unknown` from `.transform(..)` [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#workaround-1-return-unknown-from-transform \"Direct link to Workaround 1: Return unknown from .transform(..)\")\n\nYou can do this either by annotating the transform function’s return type or type casting the value and letting inference handle it.\n\n```ts\nconst schema = z.object({\n\tq: z.string(),\n\tsort: z\n\t\t.string()\n\t\t.transform((value): unknown => value.split(':'))\n\t\t// Or ━┑\n\t\t// .transform((value) => value.split(':') as unknown)\n\t\t.pipe(someOtherSchemaExpectingValidSortParam)\n});\n```\n\n### Workaround 2: Use `z.any()` explicitly [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#workaround-2-use-z-any-explicitly \"Direct link to Workaround 2: Use z.any() explicitly\")\n\nThis essentially opts out of any kind of type checking at that particular interface which can be a good short-term solution if you need it but should be avoided if possible.\n\n```ts\nconst schema = z.object({\n\tq: z.string(),\n\tsort: z\n\t\t.string()\n\t\t.transform((value) => value.split(':'))\n\t\t.pipe(z.any().pipe(someOtherSchemaExpectingValidSortParam))\n});\n```\n\n## `.superRefine()` is now `.check()` [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#superRefine-is-now-check \"Direct link to .superRefine() is now .check()\")\n\nAllegedly `check` is just `superRefine` but [with a “cleaner API”](https://zod.dev/v4/changelog?id=superrefine-deprecated). No more `return z.NEVER` and `z.ZodIssueCode.custom`. Instead of `ctx.addIssue()` you just have to `ctx.issues.push(..)`. Just kidding about `z.NEVER` by the way… apparently it’s still used in [pipes and transforms](https://zod.dev/api?id=transforms) to “exit the transform without impacting the inferred return type”.\n\nThis is an interesting choice. We can only speculate about the trade-offs that might have been considered when making this change. There are benefits to building APIs like `.refine()` by composing lower level and more versatile APIs (like `.check()`) for things like code simplicity, testability, and overall cohesiveness.\n\nIn terms of the user API, deciding to favor direct data manipulation (`ctx.issues.push(..)`) over function calls (`ctx.addIssue(..)`) seems like a step back in terms of level of abstraction. To use the API you need to know that “adding an issue” requires pushing a new issue value onto a list called `ctx.issues`. Those details leaking out may be a benefit if the goal is to add friction and discourage users from reaching for these specific escape hatches.\n\nIn practice, we only ever use `.superRefine` in a few spots and the migration was painless, so let’s all just agree to calm down and see how this one plays out, ok?\n\n## Working with `ZodError`s is a bit different [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#working-with-zodErrors-is-a-bit-different \"Direct link to Working with ZodErrors is a bit different\")\n\nInstead of `error.flatten()` we now have `z.flattenError(error)`. Instead of `error.format()` we now have `z.treeifyError(error)`.\n\nIf you want a nice single string that captures all the problems on a schema you can now use [`z.prettifyError(error)`](https://zod.dev/error-formatting?id=zprettifyerror) and it will pretty-print a summary of all the (possibly nested) issues like this:\n\n```\n✖ Unrecognized key: \"extraKey\"\n✖ Invalid input: expected string, received number\n → at username\n✖ Invalid input: expected number, received string\n → at favoriteNumbers[1]\n```\n\n## Migrating away from `.merge()`? Do this: [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#migrating-away-from-merge-do-this \"Direct link to Migrating away from .merge()? Do this:\")\n\nThe deprecation message on `.merge()` suggets replacing it with `a.extend(b.shape)`. However, the zod 4 documentation for [`.extend()`](https://zod.dev/api?id=extend) goes on to say that there is _another_ form which has better `tsc` performance (using destructuring):\n\n```ts\nconst foo = z.object({\n\tfoo: z.string(),\n});\n\nconst bar = z.object({\n\tbar: z.string(),\n});\n\n// zod 3\nconst fooBar = foo.merge(bar);\n\n// zod 4 (based on deprecation message suggestion)\nconst fooBar = foo.extend(bar.shape);\n\n// -- just do this instead: -v\n\n// ✅ zod 4 (best performing, according to docs)\nconst fooBar = z.object({\n\t...foo.shape,\n\t...bar.shape,\n});\n```\n\n## `z.string()` refinement helpers promoted [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#z-string-refinement-helpers-promoted \"Direct link to z.string() refinement helpers promoted\")\n\nA bunch of helpers that were previously on `ZodString` (like `z.string().email()`) were promoted to top-level schema types (`z.email()`).\n\nWith that come a few adjustments to the level of strictness for these checks. `z.uuid()` will now validate more strictly against RFC 9562/4122 (specifically, the variant bits must be 10 per the spec). For something a little more “UUID-ish” you can use `z.guid()`.\n\n## `z.coerce` input is now `unknown` [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#z-coerce-input-is-now-unknown \"Direct link to z.coerce input is now unknown\")\n\n`z.coerce` was changed so that the inferred input type is now `unknown`. This makes a lot of sense and in at least one case meant that we could remove a workaround that was put in place just so that we could get a correctly inferred input type that was accurate in how permissible it was.\n\n## Case Study: `tsc` metrics comparison [\\#](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4\\#case-study-tsc-metrics-comparison \"Direct link to Case Study: tsc metrics comparison\")\n\nAfter having gone through this migration on a fairly large project (~100k LoC) that makes significant use of zod schemas, here are the numbers:\n\n| Metric (agg) | Before | After | Change |\n| --- | --: | --: | --: |\n| Identifiers | 3,534,744 | 3,373,893 | -160,851 (-4.55%) |\n| Symbols | 4,486,388 | 4,364,030 | -122,358 (-2.73%) |\n| Types | 1,193,186 | 1,028,579 | -164,607 (-13.80%) |\n| Instantiations | 16,421,354 | 14,147,656 | -2,273,698 (-13.85%) |\n| Memory used | 2,747,064K | 2,630,832K | -116,232K (-4.23%) |\n| Build time\\* | 40.07s | 37.50s | -2.57s (-6.41%) |\n\nWell we didn’t quite hit the 100x reduction in type instantiations [claimed in the zod 4 introduction](https://zod.dev/v4#100x-reduction-in-tsc-instantiations) but a ~14% improvement is still significant.\n\nFor this project, the inciting incident that precipitated the need to urgently prioritize these updates was a problem with a few particularly deeply nested discriminated unions. We were hitting TS2589 errors (“Type instantiation is excessively deep and possibly infinite”) when trying to use the inferred zod schema types as generic parameters to `react-hook-form`’s `useWatch` (and `useForm`, although you can omit it and rely on inference if you like).\n\nThis isn’t the first time we’ve invested in improving the TypeScript performance on this project and I’m sure it won’t be the last. Every effort leaves a trail of lessons, frustrations, and small joys. Come back once in a while, and I’ll tell you another story.\n\n## Related Articles\n\n- [![TypeScript Best Practices at Viget](https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6ODAsImhlaWdodCI6ODAsImZpdCI6ImNvdmVyIn0sIndpdGhNZXRhZGF0YSI6dHJ1ZSwidG9Gb3JtYXQiOiJ3ZWJwIiwid2VicCI6eyJxdWFsaXR5Ijo4MH19fQ==?signature=0beb53cd7e3f61f2285a94fc120c6ea23b9d4391724aff19b5fbb159501205de)\\\\\n\\\\\nArticle\\\\\n\\\\\n**TypeScript Best Practices at Viget** \\\\\n\\\\\nSolomon Hawk](https://www.viget.com/articles/typescript-best-practices-at-viget/)\n- [![Using Claude Code More Intentionally](https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvY2xhdWRlLWFydGljbGUtaWNvbi5wbmciLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjgwLCJoZWlnaHQiOjgwLCJmaXQiOiJjb3ZlciJ9LCJ3aXRoTWV0YWRhdGEiOnRydWUsInRvRm9ybWF0Ijoid2VicCIsIndlYnAiOnsicXVhbGl0eSI6ODB9fX0=?signature=b2fe150dd65329e69d1b951ee5b7d1d7f77bd0b4309631f5189118fcc8569a3a)\\\\\n\\\\\nArticle\\\\\n\\\\\n**Using Claude Code More Intentionally** \\\\\n\\\\\nMax Myers](https://www.viget.com/articles/using-claude-code-intentionally/)\n- [![Big Prompts & Beagle Power: How We Built an AI Language App in 24 Hours](https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6IkJhcm5hYnkucG5nIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjo4MCwiaGVpZ2h0Ijo4MCwiZml0IjoiY292ZXIifSwid2l0aE1ldGFkYXRhIjp0cnVlLCJ0b0Zvcm1hdCI6IndlYnAiLCJ3ZWJwIjp7InF1YWxpdHkiOjgwfX19?signature=6f44bfe648e4e5aad53741ccdb08c8f40010176f63ca4c3990eb5101b4cc7cc2)\\\\\n\\\\\nArticle\\\\\n\\\\\n**Big Prompts & Beagle Power: How We Built an AI Language App in 24 Hours** \\\\\n\\\\\nLaura Lighty](https://www.viget.com/articles/big-prompts-beagle-power-how-we-built-an-ai-language-app-in-24-hours/)\n\n### The Viget Newsletter\n\nNobody likes popups, so we waited until now to recommend our newsletter, featuring thoughts, opinions, and tools for building a better digital world. [Read the current issue.](https://www.viget.com/newsletter)\n\n[Subscribe Here (opens in new window)](http://eepurl.com/gtHqsj)\n\n- [Home](https://www.viget.com/)\n- [Articles](https://www.viget.com/articles)\n- [Lessons from Upgrading a Large TypeScript App to Zod 4](https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4#hero)\n\n[Subscribe (opens in a new window)](http://eepurl.com/gtHqsj)\n\nShare\n\n- [Share this page](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Share this page](http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)\n- [Post this page](https://x.com/intent/tweet?text=We%20recently%20upgraded%20a%20large%20application%20from%20Zod%203%20to%204.%20The%20performance%20improvements%20are%20great%20and%20apart%20from%20one%20or%20two%20things%2C%20the%20migration%20was%20straightforward.%20Here%20are%20a%20few%20things%20we%20learned%20along%20the%20way.%20https%3A%2F%2Fwww.viget.com%2Farticles%2Flessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4)","metadata":{"twitter:site":"@viget","ogImage":"https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MTIwMCwiaGVpZ2h0Ijo2MDAsImZpdCI6ImNvdmVyIn0sIndpdGhNZXRhZGF0YSI6dHJ1ZSwidG9Gb3JtYXQiOiJwbmciLCJwbmciOnsiY29tcHJlc3Npb25MZXZlbCI6MiwicHJvZ3Jlc3NpdmUiOmZhbHNlfX19?signature=80e46a4d50a2e2833da81bd7110d318b322746376623a3f32c1a30d3ece23729","twitter:card":"summary_large_image","og:image":"https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MTIwMCwiaGVpZ2h0Ijo2MDAsImZpdCI6ImNvdmVyIn0sIndpdGhNZXRhZGF0YSI6dHJ1ZSwidG9Gb3JtYXQiOiJwbmciLCJwbmciOnsiY29tcHJlc3Npb25MZXZlbCI6MiwicHJvZ3Jlc3NpdmUiOmZhbHNlfX19?signature=80e46a4d50a2e2833da81bd7110d318b322746376623a3f32c1a30d3ece23729","name":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","og:title":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","og:url":"https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4","ogUrl":"https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4","og:description":"We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way.","ogDescription":"We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way.","title":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","og:type":"website","image":"https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MTIwMCwiaGVpZ2h0Ijo2MDAsImZpdCI6ImNvdmVyIn0sIndpdGhNZXRhZGF0YSI6dHJ1ZSwidG9Gb3JtYXQiOiJwbmciLCJwbmciOnsiY29tcHJlc3Npb25MZXZlbCI6MiwicHJvZ3Jlc3NpdmUiOmZhbHNlfX19?signature=80e46a4d50a2e2833da81bd7110d318b322746376623a3f32c1a30d3ece23729","description":"We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way., We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way.","twitter:image":"https://svc.assets.viget.com/eyJidWNrZXQiOiJ2Z3QtdmlnZXRjb20tYWxsLWFzc2V0cyIsImtleSI6ImJsb2cvdHlwZXNjcmlwdC1hcnRpY2xlLWltYWdlLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MTIwMCwiaGVpZ2h0Ijo2MDAsImZpdCI6ImNvdmVyIn0sIndpdGhNZXRhZGF0YSI6dHJ1ZSwidG9Gb3JtYXQiOiJwbmciLCJwbmciOnsiY29tcHJlc3Npb25MZXZlbCI6MiwicHJvZ3Jlc3NpdmUiOmZhbHNlfX19?signature=80e46a4d50a2e2833da81bd7110d318b322746376623a3f32c1a30d3ece23729","og:site_name":"https://www.viget.com","ogTitle":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","ogSiteName":"https://www.viget.com","twitter:description":"We recently upgraded a large application from Zod 3 to 4. The performance improvements are great and apart from one or two things, the migration was straightforward. Here are a few things we learned along the way.","og:image:width":"1200","twitter:creator":"@shawkdsn","ahrefs-site-verification":"13eed18d43a1fb5ba7f2a04c6797445232c156eaf9a4ec07fe0fdbd291361c5e","viewport":"width=device-width, initial-scale=1, minimum-scale=1","fb:pages":"44843471127","language":"en","twitter:title":"Lessons from Upgrading a Large TypeScript App to Zod 4 | Viget","og:image:height":"1200","favicon":"https://www.viget.com/favicon.ico","scrapeId":"019d3953-5db3-7406-9362-e9fb000ebc45","sourceURL":"https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4","url":"https://www.viget.com/articles/lessons-learned-upgrading-a-large-typescript-application-from-zod-3-to-4","statusCode":200,"contentType":"text/html; charset=UTF-8","timezone":"America/New_York","proxyUsed":"basic","cacheState":"miss","indexId":"33e67d69-8a59-40a1-ac57-bc0c13d109ce","creditsUsed":1}},{"url":"https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0","title":"Migrating to Zod 4: The Complete Guide to Breaking Changes ...","description":"Everything you need to know about upgrading from Zod 3 to Zod 4. Covers all breaking changes, the new unified error API, @zod/mini, ...","position":3,"markdown":"If you've written TypeScript in the last three years, you've used Zod. It's in your API routes, your form validation, your tRPC endpoints, your environment variable parsers. Zod is _everywhere_ — and Zod 4 just changed everything about it.\n\nThe headline numbers are staggering: **14x faster** string parsing, **7x faster** array parsing, **2.3x smaller** core bundle, and up to **10x faster** TypeScript compilation. But those gains come with a laundry list of breaking changes that will make your CI turn red the moment you bump the version.\n\nThis guide covers every single breaking change, shows you the exact before/after code, and gives you a migration strategy that won't leave your team debugging schema failures for a week.\n\n## What Changed and Why\n\nZod 3 was designed when TypeScript's type system was less capable and bundle size wasn't a primary concern for server-side validation libraries. As the ecosystem evolved — serverless functions with cold starts, edge runtimes with strict size limits, monorepos with thousands of schemas — Zod 3's architecture started showing its age.\n\nZod 4 is a ground-up rewrite that addresses three fundamental problems:\n\n1. **Bundle size**: Zod 3's method-chaining API made tree-shaking nearly impossible. Every import pulled in the entire library.\n2. **Parse performance**: The validation pipeline had unnecessary overhead from object creation and prototype chain lookups.\n3. **TypeScript compilation speed**: Complex Zod schemas generated enormous type instantiation counts, slowing `tsc` to a crawl in large codebases.\n\nThe fix required breaking the API surface. Let's go through every change.\n\n## Breaking Change \\#1: The Unified Error Parameter\n\nThis is the change that will break the most code. Zod 3 had three separate ways to customize error messages:\n\n```\n// ❌ Zod 3 — Three different parameters\nconst schema = z.string({\n required_error: \"Name is required\",\n invalid_type_error: \"Name must be a string\",\n});\n\nconst email = z.string().email({ message: \"Invalid email format\" });\n\nconst age = z.number({\n errorMap: (issue, ctx) => {\n if (issue.code === \"too_small\") return { message: \"Must be 18+\" };\n return { message: ctx.defaultError };\n },\n});\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nZod 4 replaces all three with a single `error` parameter:\n\n```\n// ✅ Zod 4 — Unified error parameter\nconst schema = z.string({\n error: \"Name is required\", // Simple string\n});\n\nconst email = z.string().email({\n error: \"Invalid email format\", // Same pattern everywhere\n});\n\nconst age = z.number({\n error: (issue) => { // Function form for complex logic\n if (issue.code === \"too_small\") return \"Must be 18+\";\n return \"Invalid age\";\n },\n});\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThe `message` property is now deprecated across all methods. `required_error`, `invalid_type_error`, and `errorMap` are gone entirely. Use the unified `error` parameter everywhere. The official codemod handles most of these automatically:\n\n```\nnpx @zod/codemod --transform v3-to-v4 ./src\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nBut you'll need to manually review any custom `errorMap` implementations, because the function signature changed from `(issue, ctx) => { message: string }` to `(issue) => string`.\n\n## Breaking Change \\#2: Top-Level Format Validators\n\nZod 3 used method chains for string format validation. Zod 4 promotes the most common ones to top-level functions:\n\n```\n// ❌ Zod 3 — Method chaining\nconst emailSchema = z.string().email();\nconst uuidSchema = z.string().uuid();\nconst urlSchema = z.string().url();\nconst isoDateSchema = z.string().datetime();\n\n// ✅ Zod 4 — Top-level functions\nconst emailSchema = z.email();\nconst uuidSchema = z.uuid();\nconst urlSchema = z.url();\nconst isoDateSchema = z.iso.datetime();\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nWhy? Because `z.string().email()` pulls in the entire `ZodString` class even if you only need email validation. Top-level functions enable proper tree-shaking. If your bundle only uses `z.email()` and `z.object()`, the bundler can eliminate everything else.\n\n**Important**: The method-chain versions (`z.string().email()`) still work but are officially **deprecated** in Zod 4. They won't be removed immediately, so you can migrate gradually, but expect them to be dropped in a future major version.\n\nAlso note: `z.string().ip()` and `z.string().cidr()` are **dropped entirely** — replaced by `z.ipv4()`, `z.ipv6()`, `z.cidrv4()`, and `z.cidrv6()` respectively. And `z.uuid()` is now stricter, validating RFC 9562/4122 variant bits. If you need a more permissive pattern, use the new `z.guid()`.\n\n## Breaking Change \\#3: Coercion Input Types Are Now `unknown`\n\nThe `z.coerce` namespace still exists in Zod 4, but the **input type** of all coerced schemas changed from the specific type to `unknown`:\n\n```\nconst schema = z.coerce.string();\n\ntype SchemaInput = z.input;\n// Zod 3: string\n// Zod 4: unknown\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThis is more honest about what coercion actually does — it accepts _anything_ and tries to convert it. But it means that TypeScript will no longer narrow the input type for you, which can surface type errors in code that relied on the narrowed input type.\n\nIf you're piping coerced types, be aware that the interaction with `.pipe()` has changed:\n\n```\n// This may cause type issues in Zod 4\nconst schema = z.coerce.string().pipe(z.email());\n// Check the v4 changelog for pipe + coerce edge cases\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThe `z.coerce` namespace itself (`z.coerce.number()`, `z.coerce.string()`, etc.) still works as before — the API surface hasn't changed, only the inferred input type.\n\n## Breaking Change \\#4: Optional + Default Behavior\n\nThis is a subtle but dangerous change. In Zod 3, calling `.optional()` on a schema with `.default()` or `.catch()` would ignore missing properties. In Zod 4, the default/catch value is always applied:\n\n```\nconst schema = z.object({\n theme: z.string().default(\"light\").optional(),\n});\n\n// Zod 3: { theme: undefined } → { theme: undefined } ← Missing property ignored\n// Zod 4: { theme: undefined } → { theme: \"light\" } ← Default applied\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThis change makes behavior more predictable, but it can break code that checks for `undefined` to detect \"not provided\".\n\nAnother `.default()` change: the default value must now match the **output** type, not the input type. In Zod 3, `.default()` would parse the default value through the schema. In Zod 4, it short-circuits and returns the default directly:\n\n```\n// Zod 3 — default matched INPUT type and was parsed\nconst schema = z.string()\n .transform(val => val.length)\n .default(\"tuna\"); // string input, parsed → 4\nschema.parse(undefined); // => 4\n\n// Zod 4 — default matches OUTPUT type, no parsing\nconst schema = z.string()\n .transform(val => val.length)\n .default(0); // number output, returned directly\nschema.parse(undefined); // => 0\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nTo replicate the old \"pre-parse default\" behavior, Zod 4 introduces `.prefault()`:\n\n```\n// ✅ Zod 4 — .prefault() for old .default() behavior\nconst schema = z.string()\n .transform(val => val.length)\n .prefault(\"tuna\"); // string gets parsed through transform\nschema.parse(undefined); // => 4\n```\n\nEnter fullscreen modeExit fullscreen mode\n\n## Breaking Change \\#5: TypeScript Strict Mode Required\n\nZod 4 requires `strict: true` in your `tsconfig.json`. If you're running in non-strict mode, you'll get type errors:\n\n```\n{\n \"compilerOptions\": {\n \"strict\": true, // Required for Zod 4\n \"target\": \"ES2022\",\n \"module\": \"ESNext\"\n }\n}\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nSpecifically, Zod 4 relies on features enabled by strict mode: `strictNullChecks`, `strictFunctionTypes`, and `noImplicitThis`. If you can't enable full strict mode, you need at minimum:\n\n```\n{\n \"compilerOptions\": {\n \"strictNullChecks\": true,\n \"strictFunctionTypes\": true\n }\n}\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nZod 4 is tested against TypeScript 5.5+. If you're on an older TS version, upgrade TypeScript first.\n\n## New Feature: [@zod](https://dev.to/zod)/mini\n\nThis is the sleeper hit of Zod 4. If you're building for edge runtimes, serverless functions, or any environment where bundle size matters, `@zod/mini` gives you Zod's core validation in a fraction of the size:\n\n```\nimport { z } from \"@zod/mini\";\n\n// Same API, dramatically smaller bundle\nconst UserSchema = z.object({\n name: z.string().check(z.minLength(1)),\n email: z.string().check(z.email()),\n role: z.enum([\"admin\", \"user\", \"viewer\"]),\n});\n\ntype User = z.infer;\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nKey differences from the full `zod` package:\n\n| Feature | `zod` | `@zod/mini` |\n| --- | --- | --- |\n| Core bundle size | ~13KB gzipped | ~5.5KB gzipped |\n| Tree-shakable | ✅ | ✅ (better) |\n| `.transform()` | ✅ | ❌ |\n| `.pipe()` | ✅ | ❌ |\n| `.brand()` | ✅ | ❌ |\n| `.refine()` / `.superRefine()` | ✅ | `.check()` only |\n| JSON Schema generation | ✅ | ❌ |\n\nThe key API difference is refinements. Instead of `.refine()`, `@zod/mini` uses `.check()` which accepts format validators directly:\n\n```\n// Full Zod\nconst email = z.string().email();\nconst short = z.string().min(1).max(100);\n\n// @zod/mini\nconst email = z.string().check(z.email());\nconst short = z.string().check(z.minLength(1), z.maxLength(100));\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nUse `@zod/mini` when you need validation but not transformation. For API route handlers that just validate input shapes, it's a no-brainer. For complex pipelines with `.transform()` and `.pipe()`, stick with the full package.\n\n## New Feature: Built-in JSON Schema Conversion\n\nNo more installing `zod-to-json-schema`. Zod 4 ships with native JSON Schema generation:\n\n```\nimport { z } from \"zod\";\n\nconst UserSchema = z.object({\n id: z.number().int().positive(),\n name: z.string().min(1).max(255),\n email: z.email(),\n role: z.enum([\"admin\", \"editor\", \"viewer\"]),\n metadata: z.record(z.string(), z.unknown()).optional(),\n});\n\nconst jsonSchema = UserSchema.toJSONSchema();\nconsole.log(JSON.stringify(jsonSchema, null, 2));\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nOutput:\n\n```\n{\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"integer\", \"exclusiveMinimum\": 0 },\n \"name\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 255 },\n \"email\": { \"type\": \"string\", \"format\": \"email\" },\n \"role\": { \"type\": \"string\", \"enum\": [\"admin\", \"editor\", \"viewer\"] },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": {}\n }\n },\n \"required\": [\"id\", \"name\", \"email\", \"role\"]\n}\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nAnd the reverse direction works too:\n\n```\nimport { z } from \"zod\";\n\nconst schema = z.fromJSONSchema({\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n age: { type: \"integer\", minimum: 0 },\n },\n required: [\"name\"],\n});\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThis is huge for interop with OpenAPI specs, JSON Schema-based form generators, and AI tool definitions (MCP, function calling) where you need to convert between Zod and JSON Schema regularly.\n\n## New Feature: Schema Metadata\n\nZod 4 introduces a strongly-typed metadata system for attaching arbitrary information to schemas:\n\n```\nconst NameSchema = z.string()\n .min(1)\n .max(100)\n .meta({\n label: \"Full Name\",\n placeholder: \"John Doe\",\n helpText: \"Enter your legal name as shown on your ID.\",\n fieldType: \"text\",\n });\n\n// Access metadata\nconst meta = NameSchema.meta();\n// → { label: \"Full Name\", placeholder: \"John Doe\", ... }\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThis enables powerful patterns like schema-driven form generation:\n\n```\nfunction generateFormField(schema: z.ZodType) {\n const meta = schema.meta() ?? {};\n return {\n label: meta.label ?? \"Untitled\",\n type: meta.fieldType ?? \"text\",\n placeholder: meta.placeholder ?? \"\",\n helpText: meta.helpText ?? \"\",\n required: !schema.isOptional(),\n };\n}\n\nconst formConfig = Object.entries(MyFormSchema.shape).map(\n ([name, schema]) => ({\n name,\n ...generateFormField(schema),\n })\n);\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nMetadata is preserved through schema operations like `.optional()`, `.array()`, and `.transform()`, making it reliable for building declarative form systems on top of your validation schemas.\n\n## New Feature: Internationalized Errors\n\nZod 4 ships with a locale system for translating validation error messages:\n\n```\nimport { z } from \"zod\";\nimport { es } from \"@zod/locales/es\";\nimport { ja } from \"@zod/locales/ja\";\n\n// Set the locale globally\nz.config({ locale: es });\n\nconst result = z.string().min(5).safeParse(\"hi\");\n// result.error.issues[0].message → \"Debe tener al menos 5 caracteres\"\n\n// Or per-parse\nconst result2 = z.string().min(5).safeParse(\"hi\", { locale: ja });\n// result2.error.issues[0].message → \"5文字以上である必要があります\"\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nNo more wrapping every schema with custom error maps just to support multiple languages. The locale system covers all built-in validations and can be extended with custom messages.\n\n## New Feature: Template Literal Types\n\nZod 4 introduces `z.templateLiteral()` for validating strings that follow a specific pattern:\n\n```\nconst hexColor = z.templateLiteral([\\\n z.literal(\"#\"),\\\n z.string().regex(/^[0-9a-fA-F]{6}$/),\\\n]);\n\nhexColor.parse(\"#ff00aa\"); // ✅\nhexColor.parse(\"red\"); // ❌\n\ntype HexColor = z.infer;\n// => `#${string}`\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThis is powerful for validating structured string formats like CSS values, semantic version strings, or API endpoint patterns, with full TypeScript type inference.\n\n## Performance Benchmarks\n\nThe performance improvements in Zod 4 aren't incremental — they're transformational for large-scale applications:\n\n| Operation | Zod 3 | Zod 4 | Improvement |\n| --- | --- | --- | --- |\n| String parse | 1.0x | **14x faster** | 1,300% |\n| Array parse | 1.0x | **7x faster** | 600% |\n| Object parse | 1.0x | **6.5x faster** | 550% |\n| Bundle size (core) | ~31KB gzip | ~13KB gzip | **2.3x smaller** |\n| TS type instantiations | 1.0x | **up to 10x fewer** | 900% |\n\nThe TypeScript compilation improvement is particularly impactful. In codebases with hundreds of Zod schemas (common in monorepos), the reduction in type instantiations can shave minutes off build times. One reported benchmark showed `tsc` dropping from **47 seconds to 5 seconds** after upgrading to Zod 4.\n\n## Migration Strategy: The Safe Path\n\nDon't do a big-bang migration. Here's a phased approach:\n\n### Phase 1: Preparation (Before Upgrading)\n\n1. **Ensure TypeScript strict mode** is enabled\n2. **Run the codemod** in dry-run mode to see what changes:\n\n\n```\nnpx @zod/codemod --transform v3-to-v4 --dry-run ./src\n```\n\nEnter fullscreen modeExit fullscreen mode\n\n1. **Audit custom error maps.** Search your codebase for `errorMap` — these need manual migration.\n2. **Check for `.optional().default()` patterns.** These behave differently in v4.\n3. **Verify your TypeScript version** is 5.5+\n\n### Phase 2: Apply the Codemod\n\n```\n# Install and run the codemod\nnpx @zod/codemod --transform v3-to-v4 ./src\n\n# Check what changed\ngit diff --stat\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nThe codemod handles:\n\n- `required_error` / `invalid_type_error` → unified `error` parameter\n- `z.string().email()` → `z.email()` (deprecated → top-level)\n- Import path updates\n\nIt does NOT handle:\n\n- Custom `errorMap` function signatures\n- `.default()` / `.prefault()` behavior changes\n- `z.coerce` input type narrowing issues\n- Test expectations that check specific error message formats\n\n### Phase 3: Manual Fixes\n\nAfter the codemod, search for remaining issues:\n\n```\n# Find remaining errorMap usage\ngrep -rn \"errorMap\" --include=\"*.ts\" --include=\"*.tsx\" ./src\n\n# Find z.coerce patterns\ngrep -rn \"z\\.coerce\\.\" --include=\"*.ts\" --include=\"*.tsx\" ./src\n\n# Find .optional().default() or .default().optional() chains\ngrep -rn \"\\.optional()\\.default\\|\\.default(.*).optional\" --include=\"*.ts\" --include=\"*.tsx\" ./src\n```\n\nEnter fullscreen modeExit fullscreen mode\n\n### Phase 4: Test and Validate\n\nRun your test suite. The most common failures will be:\n\n1. **Error message format changes**: Tests that assert specific error messages will fail because the default message format changed slightly.\n2. **Coercion input types**: `z.coerce.*` input types changed from specific types to `unknown`, which can surface new type errors.\n3. **Optional+default**: Any test that explicitly checks for `undefined` values on defaulted optional fields.\n\n### Phase 5: Adopt New Features (Optional)\n\nOnce the migration is stable, consider adopting new features incrementally:\n\n- Replace `zod-to-json-schema` with `.toJSONSchema()`\n- Add metadata to schemas using `z.registry()`\n- Switch validation-only schemas to `@zod/mini` for smaller bundles\n- Use `z.templateLiteral()` for structured string validation\n\n## Common Gotchas\n\n### Gotcha 1: peer dependencies\n\nLibraries that depend on Zod 3 (like older versions of tRPC, react-hook-form adapters, etc.) may not accept Zod 4 as a peer dependency. Check compatibility before upgrading:\n\n```\n# Check which packages depend on zod\nnpm ls zod\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nAs of March 2026, most major libraries have Zod 4 support: tRPC v11+, @tanstack/react-form, Conform, react-hook-form v8 with `@hookform/resolvers` v4+.\n\n### Gotcha 2: z.infer still works, but z.input and z.output changed\n\nThe type helper `z.infer` is unchanged. But if you were using `z.input` or `z.output`, the behavior around defaults and transforms may produce different types in v4.\n\n### Gotcha 3: Discriminated unions\n\n`z.discriminatedUnion()` still works but is now optimized internally. If you were relying on the error structure of discriminated union failures (checking specific issue codes), the error details may differ.\n\n### Gotcha 4: .passthrough(), .strict(), and .strip() are deprecated\n\nObject schemas in Zod 4 still default to stripping unknown keys, but `.passthrough()`, `.strict()`, and `.strip()` are all **deprecated**. Zod 4 wants you to use `.catchall()` for explicit unknown-key handling instead:\n\n```\n// ❌ Deprecated in Zod 4\nconst loose = z.object({ name: z.string() }).passthrough();\nconst strict = z.object({ name: z.string() }).strict();\n\n// ✅ Zod 4 recommended\nconst loose = z.object({ name: z.string() }).catchall(z.unknown());\nconst strict = z.object({ name: z.string() }).catchall(z.never());\n```\n\nEnter fullscreen modeExit fullscreen mode\n\nIf you use these methods extensively, you'll see deprecation warnings. Plan to migrate them.\n\n## Should You Upgrade Now?\n\n**Yes, if:**\n\n- You're starting a new project (use Zod 4 from day 1)\n- Your build times are suffering from heavy Zod schema usage\n- You deploy to edge/serverless and need smaller bundles\n- You need JSON Schema interop\n\n**Wait, if:**\n\n- Critical dependencies still require Zod 3 (check `npm ls zod`)\n- You have hundreds of schemas with complex custom `errorMap` functions\n- Your team doesn't have bandwidth for the migration right now\n\nThe performance gains alone justify the upgrade for most projects. The TypeScript compilation speed improvement is transformational for large codebases, and the bundle size reduction matters increasingly as more code runs on edge runtimes.\n\n## Conclusion\n\nZod 4 is the most impactful update to TypeScript validation since Zod itself launched. The breaking changes are real, but they're not arbitrary — every one of them exists to make Zod faster, smaller, and more TypeScript-native.\n\nThe migration path is clear: run the codemod, fix the manual cases, test, ship. Most projects can complete the migration in a day. And once you're on v4, you get access to `@zod/mini`, native JSON Schema generation, the metadata system, template literal types, and internationalized errors — features that previously required piling on third-party dependencies.\n\nStart with `npx @zod/codemod --transform v3-to-v4 --dry-run ./src`. See how much it catches. The rest is just grep and fix.\n\n* * *\n\n> 💡 **Note:** This article was originally published on the [Pockit Blog](https://pockit.tools/blog/zod-v4-migration-guide-breaking-changes-new-features/).\n>\n> Check out [Pockit.tools](https://pockit.tools/json-formatter/) for 60+ free developer utilities. For faster access, **[add it to Chrome](https://chromewebstore.google.com/detail/pockit-developer-tools-pd/lojcamfhllebjmcjmipecgecbeopookg)** and use JSON Formatter & Diff Checker directly from your toolbar.\n\n[![profile](https://media2.dev.to/dynamic/image/width=64,height=64,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F3774%2F02d4162c-978f-4471-9d39-b2928cfb9e24.png)\\\\\nSentry](https://dev.to/sentry) Promoted\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=211800)\n\n[![Sentry blog image](https://media2.dev.to/dynamic/image/width=775%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F5Buzj6m.png)](https://blog.sentry.io/how-to-reduce-ttfb/?utm_source=devto&utm_medium=paid-community&utm_campaign=perf-fy25q4-vitalsblog&utm_content=static-ad-ttfbblogshot-learnmore&bb=211800)\n\n## [How to reduce TTFB](https://blog.sentry.io/how-to-reduce-ttfb/?utm_source=devto&utm_medium=paid-community&utm_campaign=perf-fy25q4-vitalsblog&utm_content=static-ad-ttfbblogshot-learnmore&bb=211800)\n\nIn the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.\n\nIn this article, we’ll see how we can identify what makes our TTFB high so we can fix it.\n\n[Read more](https://blog.sentry.io/how-to-reduce-ttfb/?utm_source=devto&utm_medium=paid-community&utm_campaign=perf-fy25q4-vitalsblog&utm_content=static-ad-ttfbblogshot-learnmore&bb=211800)\n\nRead More\n\n\n![pic](https://media2.dev.to/dynamic/image/width=256,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png)\n\n[Create template](https://dev.to/settings/response-templates)\n\nTemplates let you quickly answer FAQs or store snippets for re-use.\n\nSubmitPreview [Dismiss](https://dev.to/404.html)\n\nAre you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's [permalink](https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0#).\n\n\nHide child comments as well\n\nConfirm\n\n\nFor further actions, you may consider blocking this person and/or [reporting abuse](https://dev.to/report-abuse)\n\n[![profile](https://media2.dev.to/dynamic/image/width=64,height=64,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F11162%2Fe5b3f7d6-ec68-49b7-bd66-72b8e070a2cf.png)\\\\\nGuardsquare](https://dev.to/guardsquare) Promoted\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=259709)\n\n[![Guardsquare image](https://media2.dev.to/dynamic/image/width=350%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FfllvfrN.jpeg)](https://hubs.la/Q03XKmLs0?bb=259709)\n\n## [Mobile App Security Predictions in 2026: How You Can Stay Ahead of Threats and Attacks](https://hubs.la/Q03XKmLs0?bb=259709)\n\nThe mobile app threat landscape is constantly changing, with attackers continuously evolving techniques. In 2026, staying one step ahead of attackers will be crucial. With Guardsquare, achieve comprehensive mobile app security without compromises.\n\n[Read more](https://hubs.la/Q03XKmLs0?bb=259709)\n\nDEV Community\n\nDropdown menu\n\n- [What's a billboard?](https://dev.to/billboards)\n- [Manage preferences](https://dev.to/settings/customization#sponsors)\n\n* * *\n\n- [Report billboard](https://dev.to/report-abuse?billboard=262072)\n\nx\n\n![Celebrate Underrepresented Voices in Tech](https://media2.dev.to/dynamic/image/width=880%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fme5v0tp25315iv3lfe65.png)\n\n# Celebrate Underrepresented Voices in Tech\n\n**Draw what comes to mind for you when you think of gender equity in tech.**\n\nWhether it’s a symbolic representation of the \"glass ceiling\" being shattered, a detailed portrait of a pioneer who paved the way, or a piece of abstract art representing the strength of a diverse community, we want to see your interpretation through code. You may use any frontend tools\n\n[Learn more](https://dev.to/devteam/join-the-2026-wecoded-challenge-and-celebrate-underrepresented-voices-in-tech-through-writing--4828?bb=262072)\n\n![DEV Community](https://media2.dev.to/dynamic/image/width=190,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png)\n\nWe're a place where coders share, stay up-to-date and grow their careers.\n\n\n[Log in](https://dev.to/enter?signup_subforem=1) [Create account](https://dev.to/enter?signup_subforem=1&state=new-user)\n\n![](https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg)![](https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg)![](https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg)![](https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg)![](https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg)","metadata":{"robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","viewport":"width=device-width, initial-scale=1.0, viewport-fit=cover","ogSiteName":"DEV Community","twitter:widgets:new-embed-design":"on","twitter:description":"Everything you need to know about upgrading from Zod 3 to Zod 4. Covers all breaking changes, the new unified error API, @zod/mini, JSON Schema conversion, metadata system, and migration strategies with before/after code examples.","theme-color":["#ffffff","#000000"],"title":"Migrating to Zod 4: The Complete Guide to Breaking Changes, Performance Gains, and New Features - DEV Community","language":"en","search-script":"https://assets.dev.to/assets/Search-b977aea0f2d7a5818b4ebd97f7d4aba8548099f84f5db5761f8fa67be76abc54.js","forem:name":"DEV Community","forem:domain":"dev.to","og:title":"Migrating to Zod 4: The Complete Guide to Breaking Changes, Performance Gains, and New Features","og:description":"Everything you need to know about upgrading from Zod 3 to Zod 4. Covers all breaking changes, the new unified error API, @zod/mini, JSON Schema conversion, metadata system, and migration strategies with before/after code examples.","head-cached-at":"1774656288","og:url":"https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0","ogImage":"https://media2.dev.to/dynamic/image/width=1200,height=627,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw7dylettx8i72wit2aq.png","twitter:title":"Migrating to Zod 4: The Complete Guide to Breaking Changes, Performance Gains, and New Features","og:image":"https://media2.dev.to/dynamic/image/width=1200,height=627,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw7dylettx8i72wit2aq.png","user-signed-in":"false","csrf-token":"dee7uxh0_8vZuOf9vgmxBjXjIOK8GXKIoi8IIW4cThznWay-wwYh6ZzCFEYzCzxo706FN-Zh2imndghSFozr6g","last-updated":"2026-03-28 00:04:48 UTC","environment":"production","application-name":"dev.to","forem:logo":"https://media2.dev.to/dynamic/image/width=512,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png","og:type":"article","ogTitle":"Migrating to Zod 4: The Complete Guide to Breaking Changes, Performance Gains, and New Features","ogUrl":"https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0","description":"Everything you need to know about upgrading from Zod 3 to Zod 4. Covers all breaking changes, the new unified error API, @zod/mini, JSON Schema conversion, metadata system, and migration strategies with before/after code examples. Tagged with zod, typescript, javascript, node.","csrf-param":"authenticity_token","twitter:site":"@thepracticaldev","apple-mobile-web-app-title":"dev.to","ogDescription":"Everything you need to know about upgrading from Zod 3 to Zod 4. Covers all breaking changes, the new unified error API, @zod/mini, JSON Schema conversion, metadata system, and migration strategies with before/after code examples.","og:site_name":"DEV Community","twitter:image:src":"https://media2.dev.to/dynamic/image/width=1200,height=627,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw7dylettx8i72wit2aq.png","keywords":"zod, typescript, javascript, node, software, coding, development, engineering, inclusive, community","twitter:card":"summary_large_image","twitter:creator":"@","favicon":"https://media2.dev.to/dynamic/image/width=32,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png","scrapeId":"019d3953-5db3-7406-9362-ee3ed2fb732d","sourceURL":"https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0","url":"https://dev.to/pockit_tools/migrating-to-zod-4-the-complete-guide-to-breaking-changes-performance-gains-and-new-features-3ll0","statusCode":200,"contentType":"text/html; charset=utf-8","timezone":"America/New_York","proxyUsed":"basic","cacheState":"miss","indexId":"d0f3ce4d-9782-4c0d-82e1-e9886b29a9c9","creditsUsed":1}},{"url":"https://www.reddit.com/r/typescript/comments/1kqka6e/introducing_zod_4/","title":"Introducing Zod 4 : r/typescript - Reddit","description":"Looks like a big performance upgrade and the breaking changes don't look too troublesome. Seems like a win to me!","position":4},{"url":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","title":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention - Medium","description":"Speedup of Zod 4 Compared to Zod 3 | Zod 4 isn't just slimmer. Plus, you'll notice smoother IDE performance and faster build times thanks to ...","position":5,"markdown":"[Sitemap](https://medium.com/sitemap/sitemap.xml)\n\n[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)\n\nSign up\n\n[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)\n\n[Medium Logo](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)\n\nGet app\n\n[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)\n\n[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)\n\nSign up\n\n[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)\n\n![](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)\n\n[**Web Tech Journals**](https://medium.com/web-tech-journals?source=post_page---publication_nav-cae2440fc3b4-1605c31acb72---------------------------------------)\n\n·\n\nFollow publication\n\n[![Web Tech Journals](https://miro.medium.com/v2/resize:fill:38:38/1*4F6sH_oVN3JcevQg5Ztgsg.png)](https://medium.com/web-tech-journals?source=post_page---post_publication_sidebar-cae2440fc3b4-1605c31acb72---------------------------------------)\n\nWeb Tech Journals brings you deep dives into frontend architecture, JavaScript, design systems, and emerging tech. Learn, build, and stay ahead of the curve.\n\nFollow publication\n\nMember-only story\n\n## Zod just leveled up — smaller bundles, faster parsing, smarter APIs\n\n# Zod 4 Is Here — Why Frontend Devs Should Pay Attention\n\n## Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch\n\n[![Rakesh Kumar](https://miro.medium.com/v2/resize:fill:32:32/1*JsMXT2_4BEJkQrwlVv7XNA.jpeg)](https://medium.com/@rakeshkumar-42819?source=post_page---byline--1605c31acb72---------------------------------------)\n\n[Rakesh Kumar](https://medium.com/@rakeshkumar-42819?source=post_page---byline--1605c31acb72---------------------------------------)\n\nFollow\n\n5 min read\n\n·\n\nAug 14, 2025\n\n11\n\n[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D1605c31acb72&operation=register&redirect=https%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72&source=---header_actions--1605c31acb72---------------------post_audio_button------------------)\n\nShare\n\n> **🎉 Not a Medium member? No worries!** Enjoy the full article for free using my [**Friend Link →**](https://rakeshkumar-42819.medium.com/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72?sk=955a853d3875a51027701f8d45927bcb)\n\nPress enter or click to view image in full size\n\n![Zod 4 Is Here — Why Frontend Devs Should Pay Attention | Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch](https://miro.medium.com/v2/resize:fit:1000/1*1__XKgk6luBDbJrQ73Misw.jpeg)\n\nIf you’re already using [**_Zod_**](https://zod.dev/v4) for TypeScript-first validation, you’re in for a serious treat.\n\nThe [**Zod 4**](https://zod.dev/v4) release isn’t just a typical upgrade — it’s a complete evolution: slimmer, smarter, and way faster.\n\nFrom sub-2KB builds to a new `zod-mini` package and blazing validation performance, Zod 4 is packed with practical upgrades for frontend developers.\n\nWhether you're validating forms, sanitizing API data, or generating JSON schemas, this release is going to make your workflow cleaner and leaner.\n\n> _✅_ Spoiler: _Zod 4 now parses strings up to_ **_14x faster_** _, and the new_`zod/v4-mini` _bundle is under_ **_2KB gzipped_** _._\n\n## _📽️_ Want the TL;DR version? Watch the Zod 4 walkthrough on YouTube by Matt Pocock.\n\n## 📦 [Smaller, Smarter Bundles](https://zod.dev/v4?id=2x-reduction-in-core-bundle-size)\n\nOne of the biggest highlights of Zod 4 is its **bundle size optimization**:\n\n- **Zod Core (v4)**: ~5.4KB gzipped (down from ~12.5KB)\n- **Zod Mini**: ~1.88KB gzipped — yes, really.\n\nThis isn’t just impressive. It’s game-changing for frontend devs working in performance-critical apps like:\n\n- SPAs\n- PWAs\n- Mobile web apps\n- Edge-rendered frameworks like Next.js or Astro\n\n```\n// Zod Mini Usage Example\nimport { z } from \"zod/v4-mini\";\n\nconst schema = z.optional(z.string());\nschema.parse(\"Hello Zod\");\n```\n\n## Create an account to read the full story.\n\nThe author made this story available to Medium members only.\n\nIf you’re new to Medium, create a new account to read this story on us.\n\n[Continue in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3Dregwall&source=-----1605c31acb72---------------------post_regwall------------------)\n\nOr, continue in mobile web\n\n[Sign up with Google](https://medium.com/m/connect/google?state=google-%7Chttps%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72%3Fsource%3D-----1605c31acb72---------------------post_regwall------------------%26skipOnboarding%3D1%7Cregister%7Cremember_me&source=-----1605c31acb72---------------------post_regwall------------------)\n\n[Sign up with Facebook](https://medium.com/m/connect/facebook?state=facebook-%7Chttps%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72%3Fsource%3D-----1605c31acb72---------------------post_regwall------------------%26skipOnboarding%3D1%7Cregister%7Cremember_me&source=-----1605c31acb72---------------------post_regwall------------------)\n\nSign up with email\n\nAlready have an account? [Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72&source=-----1605c31acb72---------------------post_regwall------------------)\n\n[![Web Tech Journals](https://miro.medium.com/v2/resize:fill:48:48/1*4F6sH_oVN3JcevQg5Ztgsg.png)](https://medium.com/web-tech-journals?source=post_page---post_publication_info--1605c31acb72---------------------------------------)\n\n[![Web Tech Journals](https://miro.medium.com/v2/resize:fill:64:64/1*4F6sH_oVN3JcevQg5Ztgsg.png)](https://medium.com/web-tech-journals?source=post_page---post_publication_info--1605c31acb72---------------------------------------)\n\nFollow\n\n[**Published in Web Tech Journals**](https://medium.com/web-tech-journals?source=post_page---post_publication_info--1605c31acb72---------------------------------------)\n\n[90 followers](https://medium.com/web-tech-journals/followers?source=post_page---post_publication_info--1605c31acb72---------------------------------------)\n\n· [Last published Dec 16, 2025](https://medium.com/web-tech-journals/dont-just-return-yield-unlocking-the-hidden-superpower-of-javascript-generators-d4b61861d94d?source=post_page---post_publication_info--1605c31acb72---------------------------------------)\n\nWeb Tech Journals brings you deep dives into frontend architecture, JavaScript, design systems, and emerging tech. Learn, build, and stay ahead of the curve.\n\nFollow\n\n[![Rakesh Kumar](https://miro.medium.com/v2/resize:fill:48:48/1*JsMXT2_4BEJkQrwlVv7XNA.jpeg)](https://medium.com/@rakeshkumar-42819?source=post_page---post_author_info--1605c31acb72---------------------------------------)\n\n[![Rakesh Kumar](https://miro.medium.com/v2/resize:fill:64:64/1*JsMXT2_4BEJkQrwlVv7XNA.jpeg)](https://medium.com/@rakeshkumar-42819?source=post_page---post_author_info--1605c31acb72---------------------------------------)\n\nFollow\n\n[**Written by Rakesh Kumar**](https://medium.com/@rakeshkumar-42819?source=post_page---post_author_info--1605c31acb72---------------------------------------)\n\n[695 followers](https://medium.com/@rakeshkumar-42819/followers?source=post_page---post_author_info--1605c31acb72---------------------------------------)\n\n· [745 following](https://medium.com/@rakeshkumar-42819/following?source=post_page---post_author_info--1605c31acb72---------------------------------------)\n\nFrontend architect by day, dev blogger by passion. Writing on React, TS, Design System, Node, WebAssembly, Microfrontends, Microservices, and UI Architecture\n\nFollow\n\n## No responses yet\n\n![](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)\n\nWrite a response\n\n[What are your thoughts?](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fweb-tech-journals%2Fzod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72&source=---post_responses--1605c31acb72---------------------respond_sidebar------------------)\n\nCancel\n\nRespond\n\n## More from Rakesh Kumar and Web Tech Journals\n\n![The Right Way to Install Python on macOS (Without Breaking Anything) | Installing Python on macOS? Don’t rely on the system version — it’s outdated and can mess things up. Let’s do it right.](https://miro.medium.com/v2/resize:fit:679/format:webp/0*-bePYNyhU0e3ZGdN)\n\n[**The Right Way to Install Python on macOS (Without Breaking Anything)**\\\\\n\\\\\n**Don’t touch system Python. Use Homebrew, set up virtual environments, and keep your Mac (and projects) clean with this foolproof…**](https://medium.com/web-tech-journals/the-right-way-to-install-python-on-macos-without-breaking-anything-5701552afebe?source=post_page---author_recirc--1605c31acb72----0---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\nAug 24, 2025\n\n![CAP Theorem in Microservices: Balancing Consistency, Availability, and Partition Tolerance](https://miro.medium.com/v2/resize:fit:679/format:webp/1*yKnJwFhIZRiTUyueGETX8g.jpeg)\n\n[**CAP Theorem in Microservices: Balancing Consistency, Availability, and Partition Tolerance**\\\\\n\\\\\n**Guide to Applying CAP Theory in Distributed Systems Design**](https://medium.com/web-tech-journals/cap-theorem-in-microservices-balancing-consistency-availability-and-partition-tolerance-df3c292bf511?source=post_page---author_recirc--1605c31acb72----1---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\nAug 24, 2024\n\n[A clap icon2](https://medium.com/web-tech-journals/cap-theorem-in-microservices-balancing-consistency-availability-and-partition-tolerance-df3c292bf511?source=post_page---author_recirc--1605c31acb72----1---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\n![20 Essential React Libraries Every Finance App Needs in 2025 (Don’t Let Your Stack Fall Behind) | UI Library Selection for Finance](https://miro.medium.com/v2/resize:fit:679/format:webp/1*VBABbN-KZ95mEiNkQJUYBQ.jpeg)\n\n[**20 Essential React Libraries Every Finance App Needs in 2025 (Don’t Let Your Stack Fall Behind)**\\\\\n\\\\\n**Ready to Outpace Rivals? Transform Your Banking, Fintech & Analytics Apps with the Latest, Must-Have React Tools — Curated for Speed…**](https://medium.com/web-tech-journals/20-essential-react-libraries-every-finance-app-needs-in-2025-dont-let-your-stack-fall-behind-7c0b2379d03a?source=post_page---author_recirc--1605c31acb72----2---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\nAug 25, 2025\n\n[A clap icon6\\\\\n\\\\\nA response icon1](https://medium.com/web-tech-journals/20-essential-react-libraries-every-finance-app-needs-in-2025-dont-let-your-stack-fall-behind-7c0b2379d03a?source=post_page---author_recirc--1605c31acb72----2---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\n![How I Use AI as a Design Systems Architect: 7 Real Workflows That Changed Everything | From auto-generating tokens to translating Figma specs into React components — here’s how AI became my silent teammate in building scalable, consistent, and human-centered design systems.](https://miro.medium.com/v2/resize:fit:679/format:webp/1*OGjo6Y5ofmJq6qSvhFCTJQ.jpeg)\n\n[**How I Use AI as a Design Systems Architect: 7 Real Workflows That Changed Everything**\\\\\n\\\\\n**From auto-generating tokens to translating Figma specs into React components — here’s how AI became my silent teammate in building…**](https://medium.com/design-systems-collective/how-i-use-ai-as-a-design-systems-architect-7-real-workflows-that-changed-everything-b6e727e68fb2?source=post_page---author_recirc--1605c31acb72----3---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\nOct 15, 2025\n\n[A clap icon11\\\\\n\\\\\nA response icon1](https://medium.com/design-systems-collective/how-i-use-ai-as-a-design-systems-architect-7-real-workflows-that-changed-everything-b6e727e68fb2?source=post_page---author_recirc--1605c31acb72----3---------------------9691ddee_31f1_4d61_952b_e1a15f8024df--------------)\n\n[See all from Rakesh Kumar](https://medium.com/@rakeshkumar-42819?source=post_page---author_recirc--1605c31acb72---------------------------------------)\n\n[See all from Web Tech Journals](https://medium.com/web-tech-journals?source=post_page---author_recirc--1605c31acb72---------------------------------------)\n\n## Recommended from Medium\n\n![10 ReactJS conceptual interview MCQs](https://miro.medium.com/v2/resize:fit:679/format:webp/1*At9RLtU2H7iXeIRsDA_OFA.png)\n\n[**If You Can Answer These 10 React Questions: You are Above Average**\\\\\n\\\\\n**Only a small percentage of developers get all of them right**](https://medium.com/@basit.miyanjee/10-reactjs-conceptual-interview-quiz-questions-690c7b19a387?source=post_page---read_next_recirc--1605c31acb72----0---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nJan 17\n\n[A clap icon108](https://medium.com/@basit.miyanjee/10-reactjs-conceptual-interview-quiz-questions-690c7b19a387?source=post_page---read_next_recirc--1605c31acb72----0---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n![Microfrontends in 2026: The Evolution from Monolithic Chaos to Modular Mastery Poster Image](https://miro.medium.com/v2/resize:fit:679/format:webp/1*H9RU8ZhFX0S2oCabJaioSA.png)\n\n[**Microfrontends in 2026: The Evolution from Monolithic Chaos to Modular Mastery**\\\\\n\\\\\n**Breaking Free from Frontend Monoliths While Avoiding the Enterprise Tax**](https://medium.com/stackademic/microfrontends-in-2026-the-evolution-from-monolithic-chaos-to-modular-mastery-21c3e743561e?source=post_page---read_next_recirc--1605c31acb72----1---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nMar 4\n\n[A clap icon59](https://medium.com/stackademic/microfrontends-in-2026-the-evolution-from-monolithic-chaos-to-modular-mastery-21c3e743561e?source=post_page---read_next_recirc--1605c31acb72----1---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n![5 Powerful Best Practices You Must Follow When Using Zustand](https://miro.medium.com/v2/resize:fit:679/format:webp/1*4ej-1rHTfJ5ji7_5XscrWg.jpeg)\n\n[**5 Powerful Best Practices You Must Follow When Using Zustand**\\\\\n\\\\\n**Learn the TOP Five Zustand best practices with simple examples.**](https://medium.com/@atulprogrammer/5-powerful-best-practices-you-must-follow-when-using-zustand-1e70e48e4f98?source=post_page---read_next_recirc--1605c31acb72----0---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nDec 3, 2025\n\n[A clap icon7\\\\\n\\\\\nA response icon1](https://medium.com/@atulprogrammer/5-powerful-best-practices-you-must-follow-when-using-zustand-1e70e48e4f98?source=post_page---read_next_recirc--1605c31acb72----0---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n![Spec-Driven Development Is Waterfall in Markdown](https://miro.medium.com/v2/resize:fit:679/format:webp/1*XFg4sZmuHaVyTIiW6giduw.jpeg)\n\n[**Spec-Driven Development Is Waterfall in Markdown**\\\\\n\\\\\n**SpecKit has 77K GitHub stars. Scott Logic tested it and found it 10x slower. The industry learned nothing from Confluence.**](https://medium.com/@iamalvisng/spec-driven-development-is-waterfall-in-markdown-e2921554a600?source=post_page---read_next_recirc--1605c31acb72----1---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nMar 16\n\n[A clap icon206\\\\\n\\\\\nA response icon5](https://medium.com/@iamalvisng/spec-driven-development-is-waterfall-in-markdown-e2921554a600?source=post_page---read_next_recirc--1605c31acb72----1---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n![React Design Patterns: Sharing Logic Without the Copy-Paste (Day 4: Render Props)](https://miro.medium.com/v2/resize:fit:679/format:webp/1*WO2dAZIC06Eh_iN7_QHeBA.png)\n\n[**React Design Patterns: Sharing Logic Without the Copy-Paste (Day 4: Render Props)**\\\\\n\\\\\n**Let me guess: you’ve built a beautiful, complex component that tracks the user’s mouse position. It took a while to get the event listeners…**](https://medium.com/@ravijabade12/react-design-patterns-sharing-logic-without-the-copy-paste-day-4-render-props-6714d41d196a?source=post_page---read_next_recirc--1605c31acb72----2---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nMar 14\n\n[A clap icon1](https://medium.com/@ravijabade12/react-design-patterns-sharing-logic-without-the-copy-paste-day-4-render-props-6714d41d196a?source=post_page---read_next_recirc--1605c31acb72----2---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n![Next.js 16 Streaming: How to Make Your Pages Load Faster](https://miro.medium.com/v2/resize:fit:679/format:webp/1*cMCfJ5l2juzd7xgfbilsSw.png)\n\n[**Next.js 16 Streaming: How to Make Your Pages Load Faster**\\\\\n\\\\\n**People expect modern websites to load instantly. But in many of them, the page waits for all data and assets to load before showing…**](https://medium.com/@sehouli.hamza/next-js-16-streaming-how-to-make-your-pages-load-faster-46d589ac70c2?source=post_page---read_next_recirc--1605c31acb72----3---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\nMar 11\n\n[A clap icon1](https://medium.com/@sehouli.hamza/next-js-16-streaming-how-to-make-your-pages-load-faster-46d589ac70c2?source=post_page---read_next_recirc--1605c31acb72----3---------------------c7eb9aac_ff18_4b3c_a3ea_4b0ef4f7975f--------------)\n\n[See more recommendations](https://medium.com/?source=post_page---read_next_recirc--1605c31acb72---------------------------------------)\n\n[Help](https://help.medium.com/hc/en-us?source=post_page-----1605c31acb72---------------------------------------)\n\n[Status](https://status.medium.com/?source=post_page-----1605c31acb72---------------------------------------)\n\n[About](https://medium.com/about?autoplay=1&source=post_page-----1605c31acb72---------------------------------------)\n\n[Careers](https://medium.com/jobs-at-medium/work-at-medium-959d1a85284e?source=post_page-----1605c31acb72---------------------------------------)\n\n[Press](mailto:pressinquiries@medium.com)\n\n[Blog](https://blog.medium.com/?source=post_page-----1605c31acb72---------------------------------------)\n\n[Privacy](https://policy.medium.com/medium-privacy-policy-f03bf92035c9?source=post_page-----1605c31acb72---------------------------------------)\n\n[Rules](https://policy.medium.com/medium-rules-30e5502c4eb4?source=post_page-----1605c31acb72---------------------------------------)\n\n[Terms](https://policy.medium.com/medium-terms-of-service-9db0094a1e0f?source=post_page-----1605c31acb72---------------------------------------)\n\n[Text to speech](https://speechify.com/medium?source=post_page-----1605c31acb72---------------------------------------)\n\nreCAPTCHA\n\nRecaptcha requires verification.\n\n[Privacy](https://www.google.com/intl/en/policies/privacy/) \\- [Terms](https://www.google.com/intl/en/policies/terms/)\n\nprotected by **reCAPTCHA**\n\n[Privacy](https://www.google.com/intl/en/policies/privacy/) \\- [Terms](https://www.google.com/intl/en/policies/terms/)","metadata":{"og:type":"article","og:description":"Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch","al:android:url":"medium://p/1605c31acb72","title":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention | by Rakesh Kumar | Web Tech Journals | Medium","robots":"index,noarchive,follow,max-image-preview:large","article:author":"https://rakeshkumar-42819.medium.com","description":"Zod just leveled up — smaller bundles, faster parsing, smarter APIs Zod 4 Is Here — Why Frontend Devs Should Pay Attention Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than …","twitter:description":"Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch","al:web:url":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","al:ios:app_name":"Medium","twitter:site":"@webtechjournals","al:android:app_name":"Medium","ogSiteName":"Medium","al:android:package":"com.medium.reader","twitter:label1":"Reading time","twitter:card":"summary_large_image","al:ios:app_store_id":"828256236","language":"en","ogImage":"https://miro.medium.com/v2/resize:fit:1200/1*1__XKgk6luBDbJrQ73Misw.jpeg","article:published_time":"2025-08-14T13:04:05.058Z","twitter:title":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention","ogDescription":"Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch","twitter:image:alt":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention | Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch","og:title":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention","twitter:image:src":"https://miro.medium.com/v2/resize:fit:1200/1*1__XKgk6luBDbJrQ73Misw.jpeg","theme-color":"#000000","og:image":"https://miro.medium.com/v2/resize:fit:1200/1*1__XKgk6luBDbJrQ73Misw.jpeg","twitter:app:name:iphone":"Medium","ogUrl":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","ogTitle":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention","viewport":"width=device-width,minimum-scale=1,initial-scale=1,maximum-scale=1","fb:app_id":"542599432471018","apple-itunes-app":"app-id=828256236, app-argument=/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72, affiliate-data=pt=698524&ct=smart_app_banner&mt=8","og:url":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","og:image:alt":"Zod 4 Is Here — Why Frontend Devs Should Pay Attention | Tiny Bundles, Blazing Speed, and a Mini Version That’s Lighter Than Your Lunch","author":"Rakesh Kumar","referrer":"unsafe-url","twitter:app:url:iphone":"medium://p/1605c31acb72","twitter:creator":"@webtechjournals","twitter:data1":"5 min read","publishedTime":"2025-08-14T13:04:05.058Z","og:site_name":"Medium","twitter:app:id:iphone":"828256236","al:ios:url":"medium://p/1605c31acb72","favicon":"https://miro.medium.com/v2/5d8de952517e8160e40ef9841c781cdc14a5db313057fa3c3de41c6f5b494b19","scrapeId":"019d3953-5db3-7406-9362-f33397e82f6c","sourceURL":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","url":"https://medium.com/web-tech-journals/zod-4-is-here-why-frontend-devs-should-pay-attention-1605c31acb72","statusCode":200,"contentType":"text/html; charset=utf-8","timezone":"America/New_York","proxyUsed":"basic","cacheState":"miss","indexId":"631cc3dd-d58c-4795-863f-cedd37628eea","creditsUsed":1}}]}}