How tRPC really works

Поділитися
Вставка
  • Опубліковано 25 гру 2024

КОМЕНТАРІ • 91

  • @igrb
    @igrb Рік тому +48

    this is insanely helpful, I didn't expect to come out of a 20 min video learning so much. Love how you turned a monster of interconnected system into an approachable diagram, keep it up man

  • @kirso
    @kirso Рік тому +1

    Man, thank you for this - I think a written article for this would kill as there is no single source (except for tRPC docs) that thoroughly explains how it really really works and I was having a trouble to wrap my head around it.

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому +1

      Thanks! I'm currently brainstorming with the tRPC team on how we can improve the docs to make everything more approachable. But maybe an article is a good idea as well :)

    • @kirso
      @kirso Рік тому

      ​@@ccccjjjjeeee Is there a way to contribute?
      I think videos are great with explanations, but for some people reading helps as you can also go at your own pace.
      I suppose there is no right or wrong here, just an idea :)

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому

      @@kirso there's a docs channel in the trpc discord

  • @succatash
    @succatash Рік тому

    For such an amazing video the screen being hard to read on mobile sucks. Keep up the great content. The most informative TRPC on how it works I've ever seen.

  • @joshtriedcoding
    @joshtriedcoding Рік тому +4

    Great overview of the whole flow! Really enjoyed watching this one

  • @nate_codes
    @nate_codes Рік тому +11

    Incredibly insightful video! The diagramming of the full process along with walking through code was incredibly effective, and makes so much about the TRPC callstack clear and comprehensible. Thank you for making this vid, keep it up CJE!

  • @cimok2000
    @cimok2000 Рік тому

    I just started using tRPC and this explains every question I had with how it works! Amazing and informative video!

  • @tarunsharma8442
    @tarunsharma8442 Рік тому +1

    Great video man! Got to learn so much about trpc, I was so much confused before this video. I love you brother.

  • @philbrk8750
    @philbrk8750 11 місяців тому

    thank you a lot. This is incredibly helpful. Videos like yours enable me to move forward in this field of programming. Going through all of this only with the tRPC docs would have probably taken me weeks or made me quit :D

  • @zeusdeux
    @zeusdeux Рік тому

    This is an awesome video! Came here from the trpc docs just to understand how it works under the hood and got exactly that. Thank you! 🙏🏻

  • @trash_dev
    @trash_dev Рік тому

    great video!
    thanks for plugging my talk ❤️

  • @CaioAraujo-ys1mc
    @CaioAraujo-ys1mc Рік тому

    Thank you some much for your videos man, you have no idea how this videos have been helping me. keep up with the great work!!

  • @mocastello9253
    @mocastello9253 Рік тому

    amazing tRPC explanation! thanks for your time and that great video!

  • @mitchellston
    @mitchellston Рік тому +1

    Awesome video! This video made me understand trpc a lot better!

  • @rdow
    @rdow Рік тому

    This was a pretty thorough explanation. One part I didn't understand is what it would look like for a middleware to do some work on the way back.

  • @zombiefacesupreme
    @zombiefacesupreme Рік тому +4

    WOW! I feel extremely confident that I know what each piece of tRPC does now, and I could *not* say that yesterday. This was just as thorough as it needed to be without getting weighed down by explaining too much of the internal processes.
    Absolutely fantastic video! You can tell that you put a lot of thought into this.

  • @YoloSwagO
    @YoloSwagO Рік тому +4

    I just had to click on this thumbnail 😂
    But besides that awesome video, perfect level of depth imo. I was happy to learn that there wasn’t an unfathomable amount of hidden magic (at least not more than a 20 minute video) that explains how trpc really works.

  • @rig-xf6or
    @rig-xf6or 9 місяців тому

    Great video thanks! I've been using ct3a to build all my companies applications but now have a good bit of confidence of how all the trpc magic works. Will be making some middlewares this week!

  • @giovannimaendra4006
    @giovannimaendra4006 Рік тому

    Thanks for the explanation! Really help me to get better understanding of TRPC flow in 20 minutes, keep it up 🔥

  • @mikedotgold
    @mikedotgold Рік тому

    This was the video I needed. Thorough explanations. Great pacing. Clear diagram. Thanks!

  • @mosescosme8629
    @mosescosme8629 10 місяців тому

    Brilliant video. Very glad to have found this.

  • @Imjoshnewton
    @Imjoshnewton Рік тому

    This is awesome. I’ve been using tRPC for a personal project and also a work project for a couple months now and feel much more confident in my knowledge of what felt like magic at the beginning. I hadn’t learned much about middle ware and now have lots of thoughts on simplifying repetitive checks in some of my procedures.

  • @bassam.2023
    @bassam.2023 Рік тому

    This is the explanation that I was looking for. 🙏🏻You are a gem. 🙌🏻Subscribed! 😁

  • @norliegh
    @norliegh Рік тому +1

    now this is beautiful. never knew about timing middlewares & output constraining. awesome video cje. 💙

  • @arianj2863
    @arianj2863 Рік тому

    I already made quite a number of apps with the t3 stack, so it's awesome to see someone with this much knowledge explaining why it works so good 🙂

  • @OtterSwims
    @OtterSwims 11 місяців тому

    This is a great explainer and helps me understand t3 app structure much better, but would be a bit nicer if we had access to the github source code you shared here so we could look at the files ourself to understand better.
    Thanks!!

  • @jamesindeed
    @jamesindeed Рік тому

    Thank you so much for making this, you did an excellent job of explaining tRPC. Subscribed only a few minutes in, please keep making content like this. One side note if you are planning on making more videos is to have your code zoomed in a bit more and switch between the view/diagram or whatever else you are displaying. 😊

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому +3

      thanks! i'm planning to make more videos, but at a fairly slow pace, maybe one a month. and yes, things are definitely too small in this video. for the next one, my target will be that it can be watched on an iPad mini without things being uncomfortably small

  • @superstarben37
    @superstarben37 Рік тому

    Damn! This is an excellently made video, thanks for sharing your knowledge

  • @Xe054
    @Xe054 Рік тому

    I love this video. I hope you make more because this was very insightful.

  • @lord12790
    @lord12790 Рік тому

    Thanks for this video, it's awesome, I hope to see more in-depth videos, keep up the good work

  • @meierschlumpf
    @meierschlumpf Рік тому

    Thank you gor this great video! Really enjoyed watching it and learning on the way

  • @ecosse31
    @ecosse31 Рік тому

    I fell with love with tRPC already from version 9 just by making some hobby projects. I really would like to have a case to use this in a production/business project and see how it goes. The most curious thing for me is using tRPC with WebSockets. Would you like to make an video w/ an example about that in future? I think that'd be a great content. Subscribed and waiting for more. Your explanations are very clear!

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому +1

      tRPC Subscriptions (their WS implementation) are still a bit rough around the edges. This means that for the time being, I'd recommend to implement WS the same way as in any other Node backend: If you're deploying to a stateful server, you can use Pusher Channels for example. If you're deploying to serverless however, you will need some external service like Socket.io.
      That being said I haven't actually used tRPC Subscriptions in a while, so it might be worth looking at again.

  • @SuperYoda7
    @SuperYoda7 Рік тому

    this is really great! Well explained, I learned so much. exactly what I was looking for thank you. Only your sketch is so small and hard to read. But regardless of that keep it up man!

  • @ThomasPoth
    @ThomasPoth Рік тому

    Soooooooooooooo useful, Thank you so much!

  • @xamutaru9431
    @xamutaru9431 Рік тому +1

    14:00 I don’t really get the going backwards in middleware, shouldn’t `timingMiddleware` print twice (also tried a simple console.log) also can’t find anything about it or FILO in documentation.

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому +1

      think of it as functions calling other functions (because that's what it is). everything before `await next({ ctx })` happens on the way "in" to the procedure, everything after happens on the way "out". So `console.time` runs before the procedure (or next middleware, if there was another one) and `console.timeEnd` runs after it.

    • @xamutaru9431
      @xamutaru9431 Рік тому +1

      @@ccccjjjjeeee gotcha, chained 3 middleware, now I see whats happening.

  • @manchao1416
    @manchao1416 Рік тому

    would love more explanations like this

  • @SonAyoD
    @SonAyoD Рік тому

    great video. thank you! more would be great on the more advanced implementations.

  • @OurDivineKing
    @OurDivineKing Рік тому

    Can't wait for T4-Stack

  • @dhaw
    @dhaw Рік тому

    Great explanation !!!

  • @hitesh97
    @hitesh97 Рік тому

    Great video, It would be great to see a video / example app of the TRPC & NextAuth with NextJs `app` directory. I would like to use it in our next application!! 👍

  • @BarisPalabiyik
    @BarisPalabiyik Рік тому

    Great Video, more of this.

  • @DennisPeters39
    @DennisPeters39 Рік тому

    Erlich gut gemacht 😉

  • @yxgen4
    @yxgen4 Рік тому +2

    Really helpful explanation of TRPC! Is there any configuration for TRPC that needs to be configured on the backend? How does this keep our backend typing and frontend typing connected? Does the backend need to exist inside of nextjs still?

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому +1

      tRPC can live inside almost any TS-based backend. It requires a bit of boilerplate to get going, but in the case of Next.js, create-t3-app sets that all up for you. If yo want to learn more, check out Chris Bautista's video that I linked to in the description!

  • @madashindeinai4783
    @madashindeinai4783 Рік тому

    Super helpful! Thx! tRPC became much more clear to me! But i still do not understand what "ssr: true" do, how it vibe with gssp, gip, gsp? How generic fetching strategies looks like with tRPC?

  • @June-c2q
    @June-c2q Рік тому

    This is so awesome

  • @yiannis_p
    @yiannis_p Рік тому

    This was also superb! So freaking helpful! Any chance you would do in the future a similar deep dive about next auth on ct3 app? Regardless, thanks again!

  • @usercl3ev2pt1b
    @usercl3ev2pt1b Рік тому

    Can you use trpc without transpiling like an environment ts is not used, jsdoc instead or build step/bundler/transpiling is necessary? For example, you can use zod with jsdoc, is it the same story for trpc?

  • @hrsikeisa
    @hrsikeisa Рік тому

    I am still wondering how TRPC manages to share types between different codebases say a simple react SPA (not Nextjs) and and express server. How is the library able know about the code in other other codebase ? Is it just that we rely on zod to do checks on both side ? that way we have to remember zod object schema - but I never saw it happening. So still wondering...

  • @naman_dw
    @naman_dw Рік тому

    6:26 you didnt scroll all the way up, I wanted to see your definition for the type CreateContextOptions to pass the session to the inner context

  • @goshmain982
    @goshmain982 Рік тому

    Insanely usefull

  • @kehindefasunle4933
    @kehindefasunle4933 Рік тому

    I just know about T3 and tRPC. Though I have used gRPC before.
    This is awesome.
    But I think the gRPC is significantly different from tRPC.
    I would like to know if this is correct. Thank you so much for the video. I love it!

  • @duckyyy2682
    @duckyyy2682 Рік тому

    underrated

  • @succatash
    @succatash Рік тому

    Anyway you have that exaclidraw saved on your github?

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому

      check the video description

    • @succatash
      @succatash Рік тому

      @Christopher Ehrlich thanks, lol I'm so blind, I'm going through all 126 repos you have on GH and it was the first link in the description. Haha.

  • @SuperKidontheblock
    @SuperKidontheblock 10 місяців тому

    That thumbnail is wild man. Lmao

  • @rig-xf6or
    @rig-xf6or 9 місяців тому

    It would be great if you done a video to explain how trpc works with nextjs react server components (i.e. when using .query() instead of .useQuery()). I intend to keep using trpc for the forseeable so i can build out a mono repo of all my applications with different clients that share the same backend / auth / types.

  • @facuflooo
    @facuflooo Рік тому

    Thanks a lot for the video, is it possible to use SSG with tRPC? If i use getSP with the api.example get query for example i need the context.

  • @ПавелПитерский-д7г

    Thanks for the video, very clear!
    Is there any guides how we can use SSE together with tRPC \ next js?

  • @alexferreli8381
    @alexferreli8381 Рік тому

    Super clear tutorial! Thank you for the video! I'm struggling to add ad Authorization header for a WebSocket connection. HttpLink and HttpBatchLink just have a function "headers" that permit to edit headers before each request. The same function isn't available for WsLink. Do you know i could do this? I'm not finding nothing on internet, very strange that nobody need to authorize a WsClient.

    • @OtterSwims
      @OtterSwims 11 місяців тому

      any luck on this? I'd like to do the same

  • @miguelsantiagovelasquezrui765

    helpful for someone who is frontend 😂
    Thanks!

  • @petter9078
    @petter9078 Рік тому

    Good stuff sir

  • @merotuts9819
    @merotuts9819 Рік тому

    Should I use tRPC for already existing backend API endpoints on my Next JS Project just for the sake of Type validation on routes & API request/response checks ? Or would it be an overkill and I should just leave it to Zod ? I would love to hear your thoughts on using tRPC for a pre-built (non Typescript) backend .

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому

      if you don't need an "in-between" backend (for example for hiding api keys), it probably doesn't make sense in this scenario

  • @nnnpooh
    @nnnpooh Рік тому

    Thanks a lot!

  • @egecavusoglu478
    @egecavusoglu478 Рік тому

    What is the reason of including the DB connection in the context? Doesn't it clutter the context? Instead it could just be cached in it's own file and only init when it's undefined.

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому

      What do you mean by “clutter the context”? On a normal server there will only ever be one db connection. It’s passed by reference. In serverless you need to instantiate it on each lambda cold start anyway.

    • @egecavusoglu478
      @egecavusoglu478 Рік тому

      @@ccccjjjjeeee By "cluttering the context" I mean that why doesn't the procedure just get the connection (import, or getConnection() function) but instead it's passed in the context? Only including the things that are dependent on the incoming request would make sense to include in the context, not something that can be imported from the project. I'm trying to understand why including the db connection in the context is helpful.

    • @ccccjjjjeeee
      @ccccjjjjeeee  Рік тому

      @@egecavusoglu478 same reason context has the session in it - convenient to just define it once. You can import in each file if you want I guess, it will work also. Also context is convenient when it comes to testing because you can pass mocks etc.

    • @egecavusoglu478
      @egecavusoglu478 Рік тому

      @@ccccjjjjeeee I do agree that context is very helpful, and session has to be included in it since it depends on the incoming request. Prisma connection, however has nothing to do with the session or anything else with the incoming request thus I thought it did not belong in the context. I guess mocking for testing could be a reason how it'd be helpful, thanks for explaining.

  • @electroheadfx
    @electroheadfx Рік тому +1

    thanks!

  • @MertStack
    @MertStack Рік тому

    Great!

  • @nsttt
    @nsttt Рік тому

    Great vid ❤

  • @razik91
    @razik91 Рік тому

    👏👏

  • @thomasgilbert9341
    @thomasgilbert9341 Рік тому

    yooo, something I could REALLYYY use a video on is how to use tRPC with getServerSideProps(). I want to fetch/post data client side, but there are a few pages I'd like to load data from the server first.

  • @greendsnow
    @greendsnow Рік тому

    trpc is just another patch for nextjs's missing feature e2e typesafety.
    I invite you to Sveltekit.

  • @manchao1416
    @manchao1416 Рік тому

    Subscribed

  • @KlimYadrintsev
    @KlimYadrintsev Рік тому

    I followed everythin until the 16th minute. Too in depth for me for now zzz. But amazing video. Going to bookmark.

  • @raymondmichael4987
    @raymondmichael4987 Рік тому

    Your voice is Rising and falling in a very interrupting way, try to rectify that.
    BTW, this seems good, too bad I can't finish watching it 😢