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

  Рет қаралды 89,256

Software Developer Diaries

Software Developer Diaries

Күн бұрын

Пікірлер: 110
@Rafa_informatico
@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.
@ilyboc
@ilyboc Жыл бұрын
But that’s limited. It would be complicated for deep complex queries.
@TON-vz3pe
@TON-vz3pe 11 ай бұрын
Yeah, these guys did not work in middleware integration tools. They easily underestimate REST.
@shubham320
@shubham320 10 ай бұрын
So if rest already have querying facility, why do someone needs graphql?
@trumpetpunk42
@trumpetpunk42 10 ай бұрын
​@@shubham320good question!
@trumpetpunk42
@trumpetpunk42 10 ай бұрын
That's OData, right?
@khari_baat
@khari_baat 8 ай бұрын
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.
@darkwoodmovies
@darkwoodmovies 2 ай бұрын
This made me confused for the longest time. It's just a fancy version of REST in many ways.
@613fredp
@613fredp 11 ай бұрын
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
@mikhacavin
@mikhacavin Жыл бұрын
finally i understood about how TRPC, GRPC and GRAPHQL works & the concept. great video !
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Happy to hear!
@VincentJenks
@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.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Agree!
@abdulazeez.98
@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.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Thanks for sharing your experience, I wasn't aware of that! Is your REST API getting too big or what's the reason behind replacement? :)
@abdulazeez.98
@abdulazeez.98 Жыл бұрын
@@SoftwareDeveloperDiaries Thank you for the reply. Yes it is getting a bit too big, but the main problem is syncing the changes (and types) between frontend and backend. For every change in backend I need to remember (or check) exactly what it returns and reflect it in the frontend, this is a bit unreliable. I also do not like the way REST works. I sometimes find it unintuitive when I want to invoke a specific action in the backend (rather than just CRUD). GraphQL makes more sense. But for me it is not only about how difficult it is, but also modifying the current code to use it.
@kamalkamals
@kamalkamals Жыл бұрын
trpc it s not good for big project.
@gransmistad323
@gransmistad323 Жыл бұрын
@@kamalkamals You should explain why.
@kamalkamals
@kamalkamals Жыл бұрын
@@gransmistad323 the creator of trpc said that when I ask him in the streaming about version two was out
@jeniamtl6950
@jeniamtl6950 5 ай бұрын
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.
@charlesopuoro5295
@charlesopuoro5295 Ай бұрын
THANK YOU VERY MUCH FOR THIS INSIGHTFUL VIDEO.
@FikriNurdiansyah-l3r
@FikriNurdiansyah-l3r 3 ай бұрын
Cool, thats very clear explanation, thank u
@AMRITPRAKASH-y5n
@AMRITPRAKASH-y5n Жыл бұрын
this is awesome please never stop posting
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Will do so!
@naumanjabbar1877
@naumanjabbar1877 Жыл бұрын
why i will get all user data in rest ? the way we send fields to fetch in graphql , the same way i can send fields in rest api and obvioulsy api woul be getting data from db and it will get only those fields not all the data , overfetching and underfetching can be easily can be solved in rest like graphql . Any solid reason instead of typechecking to use grqphql over rest ? because overfetching and underfetching is not the reason , we can easily do that in rest also, send field name when requesting and from db only get that field and return ? So please help me to understand it better .
@SXsoft99
@SXsoft99 Жыл бұрын
a lot of languages, especially strong typed languages, have a bit of a hard time with dynamic responses on REST because most devs write a response map object that is converted to json, also you risk ending up with a spaghetti response because it's not respecting response integrity
@dipteshchoudhuri
@dipteshchoudhuri Жыл бұрын
If you are sending field names, then you might as well use graphql.
@xBodro
@xBodro Жыл бұрын
Because it's no longer rest
@elina6969
@elina6969 Жыл бұрын
Because then you're reinventing a worse GraphQL
@edhahaz
@edhahaz Жыл бұрын
The actual reason to use graphql is supporting outdated clients. Infinite backwards compatability is probably why facebook created graphql and other stuff is a meme.
@nicolascosmefernandez9197
@nicolascosmefernandez9197 9 ай бұрын
Wow thanks, very well explained! Keep it up you do a great job.
@axel_huth
@axel_huth Жыл бұрын
i already knew everything but could never have explained it so well. huth ab ;)
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Hahah thank you bro 🤗
@LaKoentjuh
@LaKoentjuh 3 ай бұрын
Nice explanation! I think you miss some of the nuances, but that's rather difficult in these short informative videos. Some remarks I didn't spot in the comments yet: * If you create an external API, don't use tRPC/gRPC. It's not well enough supported when your users can pick any language they want. * Schema's can generate code for both the client and server. If you prefer code-first implementations you can usually generate a schema and use that schema to generate typings for the other side (client/server)
@Pareshbpatel
@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}
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Thanks for the feedback! :)
@marksmith2540
@marksmith2540 5 ай бұрын
> as long as you use it perfectly it will work (paraphrased, about GraphQL) Strictly speaking this can be said or anything.
@uchoatran1917
@uchoatran1917 7 ай бұрын
Thanks, well explained.
@vovandarius
@vovandarius 5 ай бұрын
A great overview! Thank you!
@sourishdutta9600
@sourishdutta9600 Жыл бұрын
Can you create videos on microsecice communications with grpc. Best practices and all.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Sure, I’ll put it on my list :)
@shobhavenkatesh6200
@shobhavenkatesh6200 Жыл бұрын
I have currently learnt the MERN stack. Your video is really informative, but as beginner I am not understanding which one to choose and learn. Can you please tell me which one to learn among grpc, trps and graphql.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
I would suggest to learn ins and outs of the HTTP protocol and building REST services first. I have a video on REST too :)
@shobhavenkatesh6200
@shobhavenkatesh6200 Жыл бұрын
@@SoftwareDeveloperDiaries Thank you for guiding 😊
@afazeli8361
@afazeli8361 3 ай бұрын
U r sooo cool man... Loved it. Just subscribed... thanks. And u are also sooo charming, did u know that? Tnx for the free gem, plz keep up the good work
@ZorakWars
@ZorakWars 11 ай бұрын
grpc has no need for a monorepo. Maybe the schema definitions for all APIs between the client and server can exist in a single repo, but the implementation of those APIs can be in separate repos. Look to see how Lyft uses grpc + Envoy for microservices without monorepos. Also backend language does not need to be the same javascript as front end. grpc schema is language agnostic.
@marcialabrahantes3369
@marcialabrahantes3369 10 ай бұрын
gRPC and sub-masks for nested data :)
@skeletala
@skeletala 2 ай бұрын
Some treats of all of these methods can be achieved just by breaking the standards of the other. For instance: use POST for reading and include the filter criteria in the body (GET should have a body BTW, this is one reason why I hate REST)
@viplikeit
@viplikeit 6 ай бұрын
great explanation, thanks
@steveaguay
@steveaguay 3 ай бұрын
Ive seen geaphql just creat more problems. More glue code, more start services thay cost time, more security concerns. If it only works well when its set up perfectly it's really not gonna work well at many workplaces.
@chessmaster856
@chessmaster856 29 күн бұрын
What about db query? Dont know about it ? Or dont want takk about it?
@4115steve
@4115steve 5 ай бұрын
how difficult is it to use tRPC with rust and wasm in the front so that tRPC can communicate via WASM and Rust on the backend?
@fcnealvillangca7943
@fcnealvillangca7943 9 ай бұрын
I choose rest API for my personal projects and sample works coz it's battle tested I'll just adjust when I work in a place where GraphQL, TRPC, etc etc use it. but what do you recommend?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 9 ай бұрын
Depends. If you're building personal projects that you can later show on interviews, then trying out other technologies wouldn't hurt. Otherwise, use what you're most comfortable with :)
@manoj-k
@manoj-k Жыл бұрын
Very well explained ❤
@szalaierik2
@szalaierik2 Жыл бұрын
I am just studying GraphQL to widen my skillset, so not advocating for anything. But. Neither "overfetching" and "underfetching" nor not using subresources are good points against REST. Those are solved easily and supported by (probably all major) frameworks (I am only using Spring). Also I do not want to comment on the toxic teamrace you mentioned, but it is definitely not a REST problem.
@ruslan_yefimov
@ruslan_yefimov Жыл бұрын
It's not even a problem anymore if you go with RPC :)
@rajatarora8693
@rajatarora8693 8 ай бұрын
One thing I am unable to understand with help of DynamicSerializer in DRF I can easily replicate GraphQL with REST, so why to use GraphQL?
@sajidrajput317
@sajidrajput317 11 ай бұрын
Great video... I love it
@Shahid_An-AI-Engineer
@Shahid_An-AI-Engineer 2 ай бұрын
great video
@aldairlgd
@aldairlgd Ай бұрын
hot and smart. subscribed!
@s1dev
@s1dev Жыл бұрын
awesome content, thanks!
@ignatiusn9851
@ignatiusn9851 8 ай бұрын
how do the above compare with tech like Kafka?
@tgwutup
@tgwutup 9 ай бұрын
A visual aid would help solidify the concepts in this video. The information is explained well, otherwise.
@Robay146
@Robay146 6 ай бұрын
Love you too, bro.
@Koroistro
@Koroistro 4 ай бұрын
Why is Typescript on the server, who came up with that. I don't understand why it's so common.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 3 ай бұрын
Why not? 😅
@HarshShah465
@HarshShah465 Ай бұрын
Graphql is best. No other protocol has solved bandwidth issues, underfecthing, overfetching issues.
@prodigy116
@prodigy116 Жыл бұрын
I think you can just specify the ID in REST so you only get the data that you need so you won't overfetch?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Yeah you can, to fetch the data for a particular user for example, but overfetching is about the data that comes along with that request that you can’t limit.
@613fredp
@613fredp 11 ай бұрын
@@SoftwareDeveloperDiariesyes but if you implement a REST ODATA endpoint you can select only the fields and nested relationships plus their fields as well using query params (eg select / limit etc). Still though graphQL more granular but adds tech debt to teams without QL experience.
@WantMore-mc8dx
@WantMore-mc8dx Жыл бұрын
Isn't Open API also strongly typed via the Swagger stuff?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Open API and Swagger is basically just a documentation. So doesn’t really deal with the application layer and doesn’t lead to a typed codebase.
@mhasancoder
@mhasancoder Жыл бұрын
What about GraphQL and REST API combine and use, is it possible?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
It’s possible but not recommended as it would result in a mess.
@jakemonton528
@jakemonton528 Жыл бұрын
I don't agree with the 99% of the time you have to modify your frontend as well if you've modified your backend. That seems to me an architecture problem and doesn't correlate directly to REST. Frontend and backend devs rivalry seems like a company culture issue and doesn't directly relates to REST. Fetching a specific data via REST is fairly easy. You can use filters if you want to. Again, this falls down on your architecture and not necessarily because of REST ability to support this kind of stuff.
@cephaspeter842
@cephaspeter842 Жыл бұрын
Sometimes when you need to scale, and your data models needed for scaling differ from original architecture
@semenivanoff8615
@semenivanoff8615 11 ай бұрын
It is exactly what happens when there is no architect on the project and systems designed by developers
@AFTstorm
@AFTstorm 3 ай бұрын
i would mostly still go for rest opposed to graphql. Examples you gave aren't super common at all. Also why the hell would u use trpc instead of just building a monolith at that point?
@DarylDeogracias
@DarylDeogracias 5 ай бұрын
apollo graqhQL for the client, grpc json on the server. That's it.
@_thehunter_
@_thehunter_ Жыл бұрын
long live REST
@vishalthirumoorthy
@vishalthirumoorthy 4 ай бұрын
GRPC: 08:33
@dorb1337
@dorb1337 Жыл бұрын
Amazing informative important video !!! You're amazing.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
You too!
@mct_gyssels
@mct_gyssels 5 ай бұрын
g in gRPC doesn't stand for google...
@MichelPascalHohmann
@MichelPascalHohmann Жыл бұрын
Danke für das Video, können wir es ins Deutsche übersetzen lassen?
@neo1017
@neo1017 Жыл бұрын
{"status:200, "message": "I am OG................... ...................... User !" }
@domfarr2968
@domfarr2968 Жыл бұрын
99% of the time? What? 🤦‍♂️
@andgatehub
@andgatehub Жыл бұрын
Graphql is easily the worst tech you can invest in. Well, other than rust.
@user-qr4jf4tv2x
@user-qr4jf4tv2x Жыл бұрын
forget graphql
@saishanmukh3805
@saishanmukh3805 Ай бұрын
At least use PPTs ffs
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Ай бұрын
Next time for sure 😄
@dennisk648
@dennisk648 Жыл бұрын
The problem, which graphql solves is really made up.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries Жыл бұрын
Fair enough 😀
REST, gRPC, or GraphQL: Which Should You Use?
13:17
Gui Ferreira
Рет қаралды 3,3 М.
The Truth About GraphQL
12:06
Theo - t3․gg
Рет қаралды 103 М.
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,3 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 130 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН
REST vs RPC vs GraphQL API - How do I pick the right API paradigm?
15:36
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 92 М.
When to Use Kafka or RabbitMQ | System Design
8:16
Interview Pen
Рет қаралды 129 М.
gRPC Crash Course - Modes, Examples, Pros & Cons and more
1:19:38
Hussein Nasser
Рет қаралды 235 М.
Where should you use gRPC? And where NOT to use it!
10:57
CodeOpinion
Рет қаралды 86 М.
The Hidden Cost Of GraphQL And NodeJS
28:35
ThePrimeTime
Рет қаралды 197 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 283 М.
Low-Level JavaScript Performance Best Practices (Crash Course)
32:15
Software Developer Diaries
Рет қаралды 4,7 М.
GraphQL vs REST: Which is Better for APIs?
7:31
IBM Technology
Рет қаралды 210 М.
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,3 МЛН