Stop Using Zod!! This is 10x Smaller!

  Рет қаралды 19,077

Dave Gray

Dave Gray

Күн бұрын

Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
Zod provides type-safe schema validation, but what if there was an equivalent library that could send up to 10x less code to the browser? Check it out.
💖 Support me on Patreon ➜ / davegray
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- Complete Next.js Developer: bit.ly/CompNextJSDev
- Advanced React: bit.ly/AdvReactDev
- Junior to Senior Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ bit.ly/3nGHmNn
📬 Course Updates ➜ courses.davegray.codes/
❓ Questions - Please post them to my Discord ➜ / discord
☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
👇 Follow Me On Social Media:
GitHub: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
Stop Using Zod!! This is 10x Smaller!
(00:00) Intro
(00:13) Welcome
(00:36) Valibot
(00:52) The difference between Zod and Valibot
(01:21) A familiar type-safe syntax
(01:58) Inferring types from schemas
(02:18) Parsing data with schemas
(02:39) Giving credit where it is due
(03:29) Final Verdict on Valibot
📚 Tutorial References:
🔗 Valibot Builder.io article: www.builder.io/blog/introduci...
🔗 Valibot on GitHub: github.com/fabian-hiller/valibot
🔗 Valibot.dev: valibot.dev/
Was this introduction to Valibot helpful? If so, please share. Let me know your thoughts in the comments.
#zod #valibot #typescript

Пікірлер: 75
@0xtz_
@0xtz_ 10 ай бұрын
Me just start using zod 😂😂😂
@AmodeusR
@AmodeusR 10 ай бұрын
It's not a reason not to learn Zod though, it will still be used, likely will be update in the future to be even lighter, and considering Valibot is modular, you need to know what you're going to use, hence becoming quite a bit of a headache to use it, because you're likely not to remember everything you need to import, needing to go back and fourth importing things. With Zod you don't have such problem.
@0xtz_
@0xtz_ 10 ай бұрын
@@AmodeusR 💪 ofc man I'm always learning and ofc zod is the most popular one
@user-tb4ig7qh9b
@user-tb4ig7qh9b 10 ай бұрын
Continue use it becuase the library around it
@imkir4n
@imkir4n 10 ай бұрын
That's how web development works these days. 😭
@RaefetOuafiqo
@RaefetOuafiqo 10 ай бұрын
@@0xtz_ same i just used it in a project xd
@FabianHiller
@FabianHiller 10 ай бұрын
Hey Dave, thank you for featuring Valibot on your channel! 🤖
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
You're welcome! Great work Fabian! 🚀
@dopetag
@dopetag 10 ай бұрын
Thank you, Dave! I should give it a try!
@EliBates95
@EliBates95 10 ай бұрын
Saw this on twitter a while back, definitely a nice improvement. Would love to convert some projects, but needing a resolver for react hook form. Hoping to see it soon! 🎉
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Agreed - very early stages now, but I think we will see that in the future.
@Salah-YT
@Salah-YT 10 ай бұрын
Your video was truly engaging, even though it's about new technology I'm not familiar with yet. I found it surprisingly amusing and watched it till the end. I must admit, I'm not sure how ZOD works, let alone Valibot, but your content keeps me coming back for more. I look forward to understanding it all one day. Thank you for creating such entertaining and informative videos. Keep up the fantastic work! 🙂
@CanRau
@CanRau 7 ай бұрын
Also started switching first schemas over to valibot especially cause I use most of them on the client as well where bundle Size makes a big difference 🎉 also like the ergonomics
@mikevaleriano9557
@mikevaleriano9557 10 ай бұрын
for frontend, sure! but build sizes mean next to nothing in the backend, plus fastify has integrations with zod for schemas that work perfectly.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Yeah this is brand new so it does not have any of the adoption yet. Give it a little time and we will see.
@imam_robani
@imam_robani 10 ай бұрын
would you be willing to make a recoil video for state management?
@multibinary
@multibinary 10 ай бұрын
Dave Gray on May 26: "You need ZOD" Dave Two months Later: "Good bye ZOD" 😂😂... A tiny "meme-shove" from your very much loving follower of your channel, an admirer of ur comprehensive content and professional delivery. you are a true teacher and deserve a billion followers. If only people stopped watching "learning 'x' in 'y' minutes" videos and started learning from you... Thanks for all the content your creating Buddy.
@giannifed
@giannifed 10 ай бұрын
Is it works with react-hook-form? Thank you.
@ThanHtutZaw3
@ThanHtutZaw3 3 ай бұрын
Hi How can I use zod in frontend and backend MEVN . I deployed both separately in vercel So I can't access zod schema in production . Can I use mono repo for that problem ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 ай бұрын
Yes, I mono repo would be good.
@eleah2665
@eleah2665 10 ай бұрын
Interesting. Thanks.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
You're welcome
@Alex-bc3xe
@Alex-bc3xe 29 күн бұрын
The creator is a German Web Developer which has a lot of great projects and very optimized
@picatchumm64
@picatchumm64 10 ай бұрын
Hi, Yup is a good library too ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Yes, nearly as many weekly downloads as Zod on npmjs.com
@codernerd7076
@codernerd7076 10 ай бұрын
It's that time of the week again! Stop using X for Y because [insert speed/size] when X works great for years and most people are on high-speed internet 😅
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
I agree - we see this take a lot here on YT. Not usually from me though. I really like Zod, but Valibot is impressive.
@AmodeusR
@AmodeusR 10 ай бұрын
Most people? Are you sure? Most of the world is poor and hence, have poor internet connection. Not only that, most part of the traffic is mobile, which connections tend to be even slower.
@codernerd7076
@codernerd7076 10 ай бұрын
@AmodeusR poor or not even mobile internet is much faster, most got access to high speed at low prices. Looking at the world Latin America got 73% coverage of at least 1 mb/s at the lowest prices. And that data was from 2 years ago. And we talking about extra bytes here doubt it makes much of a difference
@ArcticPrimal
@ArcticPrimal 10 ай бұрын
@@AmodeusR yea exactly... even most people in the US dont have high-speed internet let alone the world. Fibre or even 5G is still have a long way to be implemented almost everywhere.
@codernerd7076
@codernerd7076 10 ай бұрын
@AmodeusR Also during the covid times many countries and companies spend tons of money on their internet infrastructure speed and availability 🚀 in the last 2 years
@snivels
@snivels 10 ай бұрын
It does make me wonder why Zod isn't modular
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Not sure either but this seems like an improvement
@snivels
@snivels 10 ай бұрын
​@@DaveGrayTeachesCodeabsolutely, thanks for bringing it to our attention
@BinaryReader
@BinaryReader 10 ай бұрын
Totally, I wish TypeScript would let me to configure 'string', 'number' and 'boolean' native types before use like valibot lets me import specific runtime types. I don't need all the TS type system, c'mon just numbers and strings!!! Seriously tho, we need better tree shaking. It's entirely possible to tree shake classes and modules with a capible compiler....just right click a class function and select "Find all References", if none are returned, cull it. I don't understand why one would resort to piece meal imports when a capable tool could just tree shake. Surely barrel importing Valibot would be the typical usage, in which case.....whats been achieved over Zod?
@fscubetech7219
@fscubetech7219 10 ай бұрын
And you great content.
@MichaelCampbell01
@MichaelCampbell01 2 ай бұрын
Nice overview; I would note though that "1x smaller" is zero, so 10x smaller? (Yes, yes, I know what you mean.)
@ArcticPrimal
@ArcticPrimal 10 ай бұрын
Dave, how does it fair with react hook form?
@cryptoboy1461
@cryptoboy1461 10 ай бұрын
Does not work with react hook form yet.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
This was just released so I don't think it has a resolver for that yet. Looks like the author is adding more support daily.
@ArcticPrimal
@ArcticPrimal 10 ай бұрын
@@cryptoboy1461 Thanks
@ArcticPrimal
@ArcticPrimal 10 ай бұрын
@@DaveGrayTeachesCode Thanks
@CTILET
@CTILET 10 ай бұрын
Should i first repeat javascript to learn Typescript?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
I don't know about "repeating" but you should _know_ JavaScript to learn TypeScript.
@mrbilchalan
@mrbilchalan 10 ай бұрын
For server side data validation I prefer class-validator. Its much cleaner and very much powerful what i think. I never heard about class-validator from you. Can you please make a tut about node, express, mongodb and typescript rest api. Thank you, Dave.
@micalevisk
@micalevisk 8 ай бұрын
class-validator was not develop to be faster nor small. And the project is not being well maintained anymore.
@darwinmanalo5436
@darwinmanalo5436 10 ай бұрын
I don't even know what Zod is. Is it similar to joi?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
zod.dev/
@AmodeusR
@AmodeusR 10 ай бұрын
Considering Valibot is modular, you need to know what you're going to use, becoming quite a bit of a headache to use it, because you're likely not to remember everything you need to import, hence needing to go back and fourth... I don't really like that. A good workaround should happen in the build time removing unnecessary code/functions.
@cryptoboy1461
@cryptoboy1461 10 ай бұрын
A very good point.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
That is another possibility. Valibot seems to mirror TS as closely as possible which removes much of the guessing concerning imports.. at least for me.
@FabianHiller
@FabianHiller 10 ай бұрын
That's right. However, it only works in practice if you, as the developer, provide additional information that the bundler can use to remove the code. However, as far as I know, no current JavaScript bundler supports this yet. A compromise is to use Valibot with a wildcard import. It is also important to note that suggesting object properties is not a JavaScript feature, but tooling in your editor. Means that we can get almost the same development experience in the future with e.g. an extension for VS code. I will write more about this in my bachelor thesis, which I will publish in a month or so.
@jhaeberli
@jhaeberli Ай бұрын
I embrace the evolution, but the downsize is in the real world now you need to know at least three different tools only for schema validation: yup, zod, valibot. Luckily they don't ask this types of questions in interviews, yet.
@waqaskhandev
@waqaskhandev 10 ай бұрын
superman for general zod.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Indeed
@techs7296
@techs7296 10 ай бұрын
Dont care about bundle size of just 20kb extra
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 ай бұрын
Fair enough but he did a great job. I'm looking forward to the support for this library continuing to grow.
@optimbro
@optimbro 9 ай бұрын
me who was about to learn zod 😂😂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 9 ай бұрын
Zod is still good and worth learning - but it is good to know about new alternatives, too! Valibot is a great choice!
@optimbro
@optimbro 9 ай бұрын
modularization looks good, and I think only people that have used Zod can only experience the real benefits of Valibot over it. @@DaveGrayTeachesCode
@anandoganiya9070
@anandoganiya9070 10 ай бұрын
Me just stated refactoring project with zod 😂
@saurabh75prakash
@saurabh75prakash 10 ай бұрын
I just started using zod😂
@ulrich-tonmoy
@ulrich-tonmoy 10 ай бұрын
So General Zod its time for your retirement
@ederEngine
@ederEngine 10 ай бұрын
buen video
@supernova82
@supernova82 2 ай бұрын
So your video title says Stop Using Zod and then later you mention in your video that you haven't even used the library yet in any of your projects. The clickbait title can get some views but reduces the presenter's credibility.
@mrfabulous3303
@mrfabulous3303 10 ай бұрын
Please make a tutorial on Svelte 😊 ,...... 🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍
@cryptoboy1461
@cryptoboy1461 10 ай бұрын
Why do you need a tutorial? They have an excellent tutorial on their website, plus the docs are very helpful.
React Typescript Tutorial for Beginners
28:24
Dave Gray
Рет қаралды 73 М.
ТАМАЕВ vs ВЕНГАЛБИ. Самая Быстрая BMW M5 vs CLS 63
1:15:39
Асхаб Тамаев
Рет қаралды 4 МЛН
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,7 МЛН
Китайка и Пчелка 10 серия😂😆
00:19
KITAYKA
Рет қаралды 2,1 МЛН
Each found a feeling.#Short #Officer Rabbit #angel
00:17
兔子警官
Рет қаралды 7 МЛН
Zod для валидации API и форм
20:19
Михаил Непомнящий
Рет қаралды 11 М.
Fixing TypeScript's Blindspot: Runtime Typechecking
15:44
Jack Herrington
Рет қаралды 28 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 453 М.
How does ZOD work? Build it yourself!
14:12
Andrew Burgess
Рет қаралды 11 М.
Modal in Next.js & React | Create a Dialog Component
22:57
Dave Gray
Рет қаралды 29 М.
ТАМАЕВ vs ВЕНГАЛБИ. Самая Быстрая BMW M5 vs CLS 63
1:15:39
Асхаб Тамаев
Рет қаралды 4 МЛН