tRPC, gRPC, GraphQL or REST: when to use what?

Published 2023-03-19
In this video I'm explaining how tRPC, gRPC, GraphQL and REST APIs work, how to choose the right one and common best practices and pitfalls.

======⚡⚡⚡======
👉 Host your website for under $2 a month: namecheap.pxf.io/c/3137064/624621/5618
======⚡⚡⚡======

🙌 Become my Patreon and get exclusive perks: patreon.com/softdevdiaries
💼 Follow me on LinkedIn and drop me a message if you'd like: linkedin.com/in/gusgadirov
💻 Also, let's connect on GitHub: github.com/gusgad

📚 Resources:
gRPC explained:    • What is RPC? gRPC Introduction.  
GraphQL error handling:    • GraphQL Error Handling is Painful  

And don't forget to subscribe for more videos like t

All Comments (21)
  • @mikhacavin
    finally i understood about how TRPC, GRPC and GRAPHQL works & the concept. great video !
  • @613fredp
    Thanks for the informative video - when describing REST folks often forget about using ODATA REST endpoint which gives you additional features such as selecting the fileds, the number of records (limit) using query string arguments giving you one additional query layer rather than having to create a bunch of rest endoints in a standard way. The ODATA query params syntax is somewhat ugly but there is editor tooling and plugins available. I mention this because although not as granular as using QL it accomplishes alot of the same requirements
  • @axel_huth
    i already knew everything but could never have explained it so well. huth ab ;)
  • @s1dev
    awesome content, thanks!
  • @Pareshbpatel
    A very clear and succinct video on the pros and cons of using tRPC, gRPC, GraphQL, and REST for client/server communication. Thank you, Guseyn {2023-06-28}
  • @khari_baat
    Great video. Regarding GraphQL: You still have to write the code to get all the data. I think it should be made clear in the video.
  • @Rafa_informatico
    Not against GraphQL but, in REST you can reques specific fields if you implement filtering (extra parameter for listing the fields you want) and you can get data from other nested resources if you implement extension (extra parameter for listing the objects you want to be extended instead of returning only their Ids). And both patterns can be combined. That also gives you the control on which of those you allow.
  • @VincentJenks
    Seems like gRPC carries the least amount of risk. Less complexity than GraphQL, faster and simpler to reason about, and the highest compatibility across all client types. I can’t get myself psyched about GraphQL, after taking a full course on it and completing a couple corporate projects with it. It just doesn’t do much for you. Another set of schemas in your stack, and you still have to do all the heavy lifting on the backend, on requests. It’s not like it eases the burden of querying your data. It’s decent for integrating disparate services, but it comes with weight and complexity.
  • @jeniamtl6950
    I think he made at least two mistakes in REST and gRPC talks: 1. In REST you do not need to under/over fetch. You can use query params. 2. In gRPC you do not need to use HTTP2. It's also mostly not supposed by reverse proxies, app gateways and so on. Correct me if I'm wrong please.
  • @marksmith2540
    > as long as you use it perfectly it will work (paraphrased, about GraphQL) Strictly speaking this can be said or anything.
  • @abdulazeez.98
    Very good points. tRPC is awesome but it’s kinda risky to stick with just typescript. Mobile apps (android and iOS) doesn’t support it. I have built a project with REST api backend and I’m thinking of replacing it with GraphQL. My main concern is the complexity, I guess I can’t have them all XD.
  • Can you create videos on microsecice communications with grpc. Best practices and all.