Zod Tutorial - All 10 places for Zod in your React / Next.js app

Поделиться
HTML-код
  • Опубликовано: 13 июн 2024
  • 👉 NEW React & Next.js Course: bytegrad.com/courses/professi...
    Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). Check out Kinde for authentication: bit.ly/3QOe1Bh
    👉 NEW React & Next.js Course: bytegrad.com/courses/professi...
    👉 Professional JavaScript Course: bytegrad.com/courses/professi...
    👉 Professional CSS Course: bytegrad.com/courses/professi...
    👉 Discord: all my courses have a private Discord where I actively participate
    🔔 Email newsletter (React + Next.js course out soon!): email.bytegrad.com
    ⏱️ Timestamps:
    0:00 Intro
    0:32 Full-Stack Overview
    1:27 Front end: number 1 - 5
    4:13 Example 1 - 2: API requests
    19:16 Example 3: Form data
    24:24 Example 4: localStorage
    28:23 Example 5: URL
    30:56 Back end: number 6 - 10
    36:06 Example 6 - 8: back-end API
    41:24 Example 9: environment variables
    43:23 Example 10: file system
    44:27 BONUS Example 11: URL (back end)
    46:12 BONUS Example 12: Database (ORM)
    48:48 Important
    #webdevelopment #programming #coding

Комментарии • 128

  • @ByteGrad
    @ByteGrad  8 месяцев назад +54

    Sorry for light mode everyone haha. Will use Eraser's dark mode next time. :) My Professional React & Next.js course is OUT NOW now! Find it here: bytegrad.com/courses/professional-react-nextjs -- this is the #1 resource to master the latest React & Next.js, my absolute best work.

    • @CookingForAlba-qh8nq
      @CookingForAlba-qh8nq 8 месяцев назад

      proper psycho vibes ❤

    • @motehpro
      @motehpro 7 месяцев назад +2

      Light mode has better contrast for me

    • @felicytatomaszewska2934
      @felicytatomaszewska2934 6 месяцев назад +1

      It took me sometime & adjusting the settings to watch but thank you for the nice content... like always :)

    • @RoyGeurts-mh3fl
      @RoyGeurts-mh3fl 6 месяцев назад +1

      Dutch Man Hi I am Roy boy geurts

    • @RoyGeurts-mh3fl
      @RoyGeurts-mh3fl 6 месяцев назад

      Good night beautiful I'm going to bed hope you sleep well and wake up refreshed I like your little sidekick
      Smile

  • @henryhwhap
    @henryhwhap 8 месяцев назад +5

    I really like your voice/tone. Its really calming and informative. Thank you.

  • @bklynpeter
    @bklynpeter 8 месяцев назад +17

    Amazing coverage of Zod use cases, and along the way, an amazing overview of the myriad data-flow possibilities in Next.js!!!

  • @segunkonibire5433
    @segunkonibire5433 7 месяцев назад +2

    Yup, another well explained concept, great stuff. I try to watch all you videos, even if on stuff I tthink I already know. Thank you so much! 🔥

  • @RobertoDuransh
    @RobertoDuransh 8 месяцев назад +4

    ok this vid is better thatnt 99% of any zod pay tutorial that i have seen.
    awesome work!

  • @HusamNasrullah
    @HusamNasrullah 8 месяцев назад +5

    Amazing, you are a real best reference to seniors before juniors ❤ keep it up 🎉

  • @joonatontti8398
    @joonatontti8398 3 месяца назад +1

    Thanks a ton! Didn't realize how flexible tool Zod really is. The tip about env variables was especially welcomed! Didn't mind the repetition, as they say it's the mother of learning 😁

  • @nurlanshukurov3864
    @nurlanshukurov3864 8 месяцев назад +9

    Sir, your explanations are cleanest I've seen. Please make more ts + reactjs videos. İf possible, about mapped types and keyof keyword

  • @Kay8B
    @Kay8B 8 месяцев назад +3

    I will watch this tomorrow because the white background is murdering my eyes but can tell this is gonna be awesome.

  • @danielwang4518
    @danielwang4518 Месяц назад +1

    Thank you sir, that is so great you covered everything we should know about zod with real life examples. You are legend.

  • @olusanyaolamide9764
    @olusanyaolamide9764 8 месяцев назад +14

    I've not even watched this video but I know it's going to be an absolute blast, I recently went through your ultimate css course and it was also a blast, your previous video on Typescript was awesome and the Generics concepts doesn't look so strange anymore was actually quite confusing before I saw the video

  • @SovitTamrakar
    @SovitTamrakar 8 месяцев назад +1

    You are a hero.. I wish I could turn back and re-work on those projects again using Zod

  • @zunairullah
    @zunairullah 6 месяцев назад +3

    I love the flowchart of external data he made i wish i could had this before when i was learning javascript 6 years ago. This flow diagram every beginner of javascript should know

  • @shash0_0
    @shash0_0 5 месяцев назад +1

    This is some very high quality content. You know your stuff!

  • @wlancer8826
    @wlancer8826 7 месяцев назад +1

    Just came from Typescript Generics! Amazing video!! Don't actually know what Zod is, though like first~

  • @dougfbf
    @dougfbf 8 месяцев назад +2

    Thanks for sharing your knowledge with us. You're the best!

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd 9 дней назад +1

    Thanks pleas keep posting videos like this

  • @r4k4210
    @r4k4210 8 месяцев назад +2

    I need a video like this with hexagonal architecture! Nice video i love it!

  • @abyshekhar
    @abyshekhar 3 месяца назад +1

    Extremely useful video. Thanks a lot

  • @SumitSingh-wz3wt
    @SumitSingh-wz3wt 7 месяцев назад +1

    Yes , these types of techniques can make our app bug free. Helpful content.

  • @pedropaternostro9917
    @pedropaternostro9917 7 месяцев назад +9

    Great content, thank you for this. Just a word of advice, compare your audio volume to others on youtube, you might want to turn it up a bit.

    • @bambydeluxe
      @bambydeluxe 6 месяцев назад

      OR as we say: I CANT HEAR YOU, YOU HAVE TO SPEAK LOUDER. Otherwise we cannot hear that damn valuable information you are sharing with us.

  • @cangorkemgunes
    @cangorkemgunes 2 месяца назад +1

    Thanks for tutorial, even if I am a blind person now because of light mode, I learnt lots of things from the video.

  • @anversadutt
    @anversadutt 8 месяцев назад +1

    pls create trpc in-depth tutorials, thanks for the awesome content

  • @froxx93
    @froxx93 3 месяца назад

    Although the video was a bit stretched by being too repetitive imo, the core info (the list of things where to use it) was really helpful. Thanks a lot!

  • @berkaycirak
    @berkaycirak 8 месяцев назад +2

    Thanks for video. I wonder something about recording settings :) do you use OBS for screen recording, if yes what is your output settings because quality is so good

  • @gmagats
    @gmagats Месяц назад +1

    Thanks, very nice explanation!

  • @rangerboi9715
    @rangerboi9715 7 месяцев назад +1

    Loved your tutorial. THank you for this great content!!!

  • @teetanrobotics5363
    @teetanrobotics5363 5 месяцев назад +2

    Thank you for your awesome content. Request you to make a long course for TRPC. if possible, please include prisma and NextAuth as well.

  • @sohrabhossain5115
    @sohrabhossain5115 8 месяцев назад +3

    Thanks for sharing your knowledge with us. It's really helpful. One thing want to know, When you will publish your react and next.js project-based course? We are waiting for this.

  • @doronsages983
    @doronsages983 8 месяцев назад +1

    that's great content, I've been waiting to this video specifically

  • @aleksandarspasov6815
    @aleksandarspasov6815 7 месяцев назад +1

    Beautiful work!

  • @prashlovessamosa
    @prashlovessamosa 8 месяцев назад +2

    Thanks for sharing knowledge sir.

  • @gmjitendra
    @gmjitendra 3 месяца назад +1

    Excellent. thanks a lot on this zod video.

  • @mohammedelmoutaouakkil
    @mohammedelmoutaouakkil 8 месяцев назад +1

    Thank you very much. your channel content is Pure Diamond

  • @alirabiei2344
    @alirabiei2344 7 месяцев назад

    your content is awesome man

  • @knownartist
    @knownartist 8 месяцев назад

    Hi! Thanks for the video, it was really helpful! Also, what is that autocomplete gray code strings in your video? Is it github copilot or some analog? I'm new to vscode, still learning.

  • @RaulCarrasco-jd9sq
    @RaulCarrasco-jd9sq 7 месяцев назад +1

    I enjoy your concepts.

  • @everyhandletaken
    @everyhandletaken 8 месяцев назад +2

    already been using Zod lately & just wanted to watch this video to see if I was using it in a logical way, but..
    I didn’t realise it had an enum type & I never thought about using it for env vars! I was using a separate library for that, for absolutely no reason, it turns out.
    Great video, thank you ☺️

    • @ByteGrad
      @ByteGrad  8 месяцев назад +3

      Fwiw, it’s still a good idea to use a library for the env variables, the way I showed in this video is just an example - has some downsides in practice

    • @everyhandletaken
      @everyhandletaken 8 месяцев назад

      @@ByteGrad it looked to provide what I am using (I think it is env-var lib) for at the moment, just basic checks & I would love to get rid of another dependency 🤔
      My checks were basically mandatory, type (string or int, generally) & maybe positive/negative for int

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 8 месяцев назад +2

    aah, simply the best
    thank you and subbed :)

  • @zlackbiro
    @zlackbiro 8 месяцев назад +5

    You can use zod for validate state and forms. I didnt watch the entire video but i assumed you covered that. Zod is runtime library so he knows what are your data in production, typescript work in build time and doesnt even goes outside development, so your code is blind. Based on zod, you can do astonishing process of data validation and build things on top of it, like formik, react hook form, data fetching, filtering, etc, etc. I using Zod in node and i am so in love with it, so clean and easy. The best node js library ever made.

  • @bappybd
    @bappybd 8 месяцев назад +3

    Awesome content

  • @sulaimanshabbir
    @sulaimanshabbir 6 месяцев назад +1

    Subscribing you and notification to all ❤🎉

  • @user-ru8hn9hb5c
    @user-ru8hn9hb5c 8 месяцев назад +1

    He's back.

  • @pfcokelly
    @pfcokelly 8 месяцев назад +2

    Great video! But Where was this a few weeks ago when I was stuck with API bug after bug.

  • @Elmasinsanodefrefire726
    @Elmasinsanodefrefire726 7 месяцев назад +1

    Great course.

  • @sbogdaniuk
    @sbogdaniuk 5 месяцев назад +1

    Nice, thanks!
    QQ: Did u measured performance for React application, with Zod validation all over the place?

  • @DamirSecki
    @DamirSecki 8 месяцев назад +1

    if I remember anything from this video is "in shape we expect it to be" :P

  • @ShortCodeDev
    @ShortCodeDev 8 месяцев назад +2

    awesome man. plz make a real based project in react native

  • @uzainmubarak9735
    @uzainmubarak9735 8 месяцев назад +2

    what zod version were you using in this example?

  • @user-mb7vg4be8e
    @user-mb7vg4be8e 7 месяцев назад +1

    Very good content.

  • @27sosite73
    @27sosite73 8 месяцев назад +1

    thank you
    once again

  • @OlegKvyatkovsky
    @OlegKvyatkovsky 8 месяцев назад +1

    Thanks for your videos

  • @oabdulazeez
    @oabdulazeez 6 месяцев назад +1

    I'm enjoying you bro....

  • @bambydeluxe
    @bambydeluxe 6 месяцев назад +1

    I registered for your email-subscription. With my real e-mail-address. I don't know how else to say, how much I like your content.

    • @ByteGrad
      @ByteGrad  6 месяцев назад

      Haha awesome!

  • @DanielRios549
    @DanielRios549 5 месяцев назад +1

    13:47 After Zod successfuly parse the product variable, this variable is sade to use, since the shape is valid, it could contain additional keys but the same is valid. But in the end I agree with you, it's better to use the validatedProduct variable, since Zod returns the data with the typing so you don't need Product type anymore, using Zod with simply don't need to create TS types manually but you still have typings, this a game changer

  • @Fanaro
    @Fanaro 8 месяцев назад +1

    Do one video on soft skills for React and/or Fullstack developers!

  • @Leofmoura87
    @Leofmoura87 7 месяцев назад +1

    Great great GREAT content. Clean coder always care about it.

  • @mariolazzari
    @mariolazzari Месяц назад +1

    Brillant!

  • @pranavrajveer3767
    @pranavrajveer3767 8 месяцев назад +1

    Hi @bytegrad. When is your nextjs course coming
    You said 30 september, not came till now

  • @27sosite73
    @27sosite73 8 месяцев назад +1

    great vid
    ty mate

  • @ElliottTheUnicorn
    @ElliottTheUnicorn 8 месяцев назад +1

    thank you!

  • @swagfinger
    @swagfinger 8 месяцев назад +1

    Very nice!

  • @yuvarajyuvi9691
    @yuvarajyuvi9691 8 месяцев назад +1

    Say if I am getting the data from an excel file , and assume it sends all fields as a string , and I know that some fields can be converted to number , so how can zod help me here?(will it parse automatically that string field to number if I use z.number() for the field)

  • @jellyfish1772
    @jellyfish1772 7 месяцев назад +1

    thank you boss!

  • @abdelhameedhamdy
    @abdelhameedhamdy 8 месяцев назад +1

    Awesome video

  • @dennisgonzales9521
    @dennisgonzales9521 4 месяца назад +1

    amazing!

  • @user-if8cf5ni3y
    @user-if8cf5ni3y 6 месяцев назад +1

    Is using zod in big project good practice? Zod also impact performace

  • @tokomnyori6730
    @tokomnyori6730 26 дней назад

    Excellent 🔥

  • @fluntimes
    @fluntimes 5 месяцев назад +1

    This channel is the best find on RUclips of 2023 for me. This video is an excellent example of why. Brilliant - this video fills in many gaps that resulted in me failing a technical interview.

  • @r34221
    @r34221 7 месяцев назад +1

    thank you so mutch i didnt know that its possible to tell zod that string could be a number😅 so basicly i have boilerplate code to do that

  • @ThanHtutZaw3
    @ThanHtutZaw3 3 месяца назад

    I can't use zod schema in two separated Backend and Frontend deployed to vercel (MEVN ) . So how can I access that zod schema in production ? Should I use mono repo ?

  • @regilearn2138
    @regilearn2138 8 месяцев назад +2

    would like to request advanced MERN(can be next) + redux + Typescript project.

  • @ryan.connaughton
    @ryan.connaughton 8 месяцев назад +1

    Would love to watch this if it was in dark mode! Will wait til day time tomorrow maybe haha

  • @lp26197
    @lp26197 8 месяцев назад

    Please, I have a question. I am Front End and I worked on real projects in Next JS with Back End people, and I want to enter the field of Back End. Do you advise me to learn C# or javascript, it's a busy frame, I'm very confused, and people distract me
    Thank you

  • @albinopepegas8391
    @albinopepegas8391 5 месяцев назад

    What theme are you using in VSCode?

  • @gerkim3046
    @gerkim3046 26 дней назад

    Hello ByteGrad and many thanks.
    QUESTION: At 41:40 you talked about validating environment variables. I have tried it but it does not work in NextJS. It always behaves as if the env variables are undefined even though process.env actually contains the variables. Please look into it. Once again thanks for the tutorial.

  • @gmd2171
    @gmd2171 8 месяцев назад

    what theme do you use? And can you teach us some system design or OOP or dsa anything as your teaching method is so good

  • @doronsages983
    @doronsages983 8 месяцев назад +1

    one comment, regarding optional chaining, you could also use it on a function call, and that way to avoid crash when the function itself doesnt exist:
    product?.price?.toFixed?.(2)
    but yea, that wont be the best solution i guess

    • @ByteGrad
      @ByteGrad  8 месяцев назад

      Ah yea good point

  • @r34221
    @r34221 7 месяцев назад

    i usually dont use direct infered type from zod i have model and azod schema then i write a convertor class to convert the data in a zod type to my model this way my presenter layer uses my model and when a change happens in an api i simply have to edit my convertor class instead of entire app

  • @coolmind2476
    @coolmind2476 2 месяца назад

    Lets say an API returns an unknown object where I dont know the possible components. How to extract the components and their types from an unknown object?

  • @markhristov7171
    @markhristov7171 8 месяцев назад +2

    What vscode theme are you using?

  • @kgdjoking7822
    @kgdjoking7822 8 месяцев назад +1

    Hello new subscriber here. Btw what code assistant tool he using ?. Anyone ?

  • @zunnoorainrafi5985
    @zunnoorainrafi5985 8 месяцев назад +1

    these days I am curiously waiting for your emails

  • @toastrecon
    @toastrecon 8 месяцев назад +7

    As cool as all of this is, I think it's kind of insane that JS is such a flawed language that it requires an absolute mountain of plugins and transpilers and validators to make it safe to work with. Looking forward to the NextJS course!

    • @Danielo515
      @Danielo515 8 месяцев назад +9

      Every language that interacts with the external world will require this care

    • @toastrecon
      @toastrecon 8 месяцев назад +1

      @@Danielo515 but I think many languages have the features built in as part of the syntax?

    • @happy_thinking
      @happy_thinking 8 месяцев назад +6

      The problem with that line of thinking is that there really isn't anything to compare Javascript with, in the sense of how wide JS adoption is. I do agree modern languages like Go or Rust are better, but if these two were used in a billion places then we might have some problems with them as well.
      The Javascript flaws are pretty well-known, but I wouldn't say custom solutions for certain problems are something unique to JS.

    • @genovo
      @genovo 8 месяцев назад +5

      Domain specific validations will always be with us.

    • @omereker8824
      @omereker8824 8 месяцев назад +4

      Everything you said is valid for the existence. Life is flawed and we need to learn how to make it “safe” for us.

  • @cristitoderita3620
    @cristitoderita3620 8 месяцев назад

    The solution to API response changes is not using "whatever" library or using a bunch of if statements.
    The solution is communication between product manager, backend and frontend and establish clear tasks that bring changes.
    Using these types of techniques, you only sugar coating the problem and possibly hidding it all together.
    Why should my frontend code look messy with tons of checkings if the backend fails to do their job or lack of communication or tasks mis-correlation ?
    3rd party Apis usually use versioning and are well documented when changed.
    Do not overcomplicate development

  • @sssrikanthhh
    @sssrikanthhh Месяц назад

    What about yup?

  • @archmad
    @archmad 8 месяцев назад

    the issue actually was not solved. no typescript, with or with zod, you will get the error when data changed. instead use a ts schema generator or use create T3

  • @ness-ee
    @ness-ee 8 месяцев назад +1

    … we have API contracts and integration tests. I want zod too

  • @cubeunicorn4055
    @cubeunicorn4055 8 месяцев назад +1

    Hi sir why you delayed your launch?
    One month delay is huge😢

    • @ByteGrad
      @ByteGrad  8 месяцев назад +6

      Just want to make it perfect haha :)

  • @user-sn4mn3ku9e
    @user-sn4mn3ku9e 8 месяцев назад +1

    👍

  • @user-ks8un9hw9v
    @user-ks8un9hw9v 7 месяцев назад +1

    Wish I would've found your content earlier.

  • @gofullstack
    @gofullstack 8 месяцев назад +1

    Dear Dart 🤣🤣🤣

  • @artyomtaranenko2267
    @artyomtaranenko2267 8 месяцев назад

    Valibot

    • @bibblebabl
      @bibblebabl 8 месяцев назад

      Basically its the same thing but you have to import all validators manually instead `z.`

  • @vitya.obolonsky
    @vitya.obolonsky 7 месяцев назад

    we should use a new feature every year)))
    zod, TS, BS, WTFS
    🤣🤣🤣

  • @lirics5864
    @lirics5864 7 месяцев назад

    editor tutorial HAHAHA

  • @Theokondak
    @Theokondak 5 месяцев назад +3

    ATM Web development is such a bad sector to work. Less jobs, less benefits, fear of being laid off, and an ecosystem that requires so much studying and its so chaotic that it's impossible to keep up. And I havent evven mentioned AI.

    • @siriusmain1763
      @siriusmain1763 2 месяца назад +1

      True, it’s so over for most of us, junior devs especially 😢

    • @haiffy
      @haiffy 26 дней назад

      Unless you live in a third world country like me😂 PHP developers are dominating here

    • @thecoolnewsguy
      @thecoolnewsguy 11 дней назад

      ​@@haiffyto be honest, third world countries are much more desirable and hirable because they don't need such high salaries

  • @sillvvasensei
    @sillvvasensei 8 месяцев назад

    Too quiet.

  • @psmontte
    @psmontte 2 месяца назад

    You. Are repetitive,