tRPC - GraphQL KILLER??!

  Рет қаралды 99,429

Theo - t3․gg

Theo - t3․gg

2 жыл бұрын

I get this question a LOT and I think it needed a more formal answer. Hope this helps! GraphQL and tRPC are both great technologies and you should use them appropriately :)
Huge s/o to Idez as always for the killer edits 🙏
Watch live on Twitch every Wednesday / theo

Пікірлер: 180
@EricBishard
@EricBishard 2 жыл бұрын
Thanks for this great video Theo, this has answered a lot of my questions and really breaks down the unknowns and presents them in an easy to understand way!
@TomDoesTech
@TomDoesTech 2 жыл бұрын
I've used GrapHQL a lot of the last 4ish years and I still love using it, although, in a lot of ways, tRPC is what I hoped GraphQL would be.
@codewithguillaume
@codewithguillaume Жыл бұрын
That is very interesting. The question for you Tom would be: would you leave GQL for TRPC?
@ogwurupatrick5641
@ogwurupatrick5641 Жыл бұрын
@@codewithguillaume Apparently, he could.
@WarframeCrunch
@WarframeCrunch Жыл бұрын
I heard from one developer that is senior that GraphQL create more issues or maybe he meant more job than it should be, so he wrote me this [google translated]: "REST, CRUD and wio. Fastify is cool because it handles requests very quickly and you can go crazy with plugins. Plus some ORM, like Prisma or TypeORM and MonoRepo terminology for the whole thing. NX is nice for embracing such things from the automatic."
@ayoub.k
@ayoub.k 2 жыл бұрын
I watch your live streams, and I enjoy re-watching the cuts you post. Your content is pure gold! Thanks for everything.
@alefdoreu
@alefdoreu 2 жыл бұрын
Love your content! I've used GQL only twice and I feel like I can agree with "REST with more steps" I'm going to try tRPC after I graduate from bootcamp. The bootcamp I'm in requires us to use Rails as our backend
@user-ui6xd8ig8i
@user-ui6xd8ig8i 7 ай бұрын
What bootcamp is it? I know AA used to have Ruby and Rails in their curriculum but they now change to Python. Both old and new curriculum have Node
@universecode1101
@universecode1101 2 жыл бұрын
Probably tRPC is the future, because it’s great, but at the moment GraphQL is more in demand by companies, looking at the job offers. For the moment it is "worthwhile" to learn GraphQL first and well, then tRPC ✌🏻
@CyberAnalyzer
@CyberAnalyzer 2 жыл бұрын
Or you convince your company to switch
@PeerReynders
@PeerReynders 2 жыл бұрын
2:38 "tRPC is bringing them closer together" i.e. Tight Coupling. RPC approaches work best when the same team controls the client and the endpoint. That way keeping them in sync isn't a problem. In any other situation it's only a matter of time until the downsides of tight coupling are going to make themselves known. The other issue is that RPC shouldn't be used when the response tends to be high latency and/or will quite commonly fail because a successful result depends on multiple back-end services collaborating successfully. With RPC you still have to be careful that the granularity of interaction isn't too fine otherwise your app's chattiness could easily become a problem under less than idea network conditions. This isn't meant as an endorsement of GraphQL.
@uziboozy4540
@uziboozy4540 2 жыл бұрын
Nah, Deepkit RPC is the future.
@yzeerkd
@yzeerkd Жыл бұрын
@Peer Reynders they're still 2 separate process so from an ops perspective, you have to treat your trpc surface as an accreting API and deploy your backend first or things will break (whether that short-lived breakage is acceptable is entirely domain-dependent and should not be assumed to be safe)
@chashdeveloper
@chashdeveloper Жыл бұрын
A lot of the time people think that graphql is going to automatically improve the performance. Graphql is what you described, 'schema' language. If you use graphql as a backend for frontend your graphql becomes extremely chatty. We had issues with port exhaustion after we deployed the graphql server as a serverless function. Graphql only improves performance if you design nested schema efficiently
@yzeerkd
@yzeerkd Жыл бұрын
If the backend is a monolith, it doesn't need to be chatty (e.g. you can use a prisma plugin or roll your own solution to optimized based on the graphqlinfo arg). Even using the data loader pattern with a monolithic graph but disparate backing services manages chattyness sufficiently. More importantly any chatty-ness is encapsulated by the backend and not directly exposed to the front-end. Latency is latency and if the backend has to talk to 20 services to give a response, that problem doesn't evaporate by using tRPC
@deimiosxxx
@deimiosxxx 2 жыл бұрын
As a one man team I've been using graphql because it saved me time when coding on the frontend because of the sheer flexibility. While I also lost 50x more time while implementing graphql on the backend properly with loaders and per field authentication.
@danielstill5625
@danielstill5625 2 жыл бұрын
Have you used AWS Amplify
@deimiosxxx
@deimiosxxx 2 жыл бұрын
@@danielstill5625 My work has strict data regulations, so no outside hosting is allowed.
@poulticegeist
@poulticegeist 2 жыл бұрын
How does graphql save you time when you have to write out the schema, resolvers, queries, mutations and fragments?
@deimiosxxx
@deimiosxxx 2 жыл бұрын
@@poulticegeist That's the joke. On the frontend it saves time because you can reformulate most queries without touching the backend. Now getting the backend ready with the schema, resolvers, auth and loaders is a pain, even with TypeGraphql/TypeOrm that merges the schema and DB declarations. So Theo's insight is spot on: if you have full control over your front and backends and your end product is not the API then Graphql is overkill.
@nathancng
@nathancng 2 жыл бұрын
@@danielstill5625 I use Amplify for a couple of my projects and it makes it super easy to manage GQL and there's barely any implementation needed to do your basic CRUD operations, and it has user-level security, etc. all baked in. BUT, Amplify isn't keeping up to date fast enough with NextJS which is a huge downer, and you get a LOT of baggage with it... so it really depends what you're using it for.
@Nil-js4bf
@Nil-js4bf 2 жыл бұрын
I've used GQL with federation for 2 years now. It feels nice to be able to create super flexible queries that fetch data from many different microservices with one query from frontend. Would love to see some more complex examples of tRPC to understand why it's good and what it's advantages are over GQL. My current impression is that tRPC has less boilerplate code since there's no need to write both the schema and resolvers - with tRPC, you just need the resolver. I haven't really cared about this since the schema is generally pretty trivial to write out but l agree that the less you can get away with, the better. I would like to see an example of tRPC where backend (which could be multiple microservices) and frontend are in different repos but I'm guessing you would have to do `import type` and be careful you don't actually import backend code into frontend. As for the perks of GQL, I like the flexibility it gives on frontend. It's easy to write out a single query that queries multiple microservices. I would need to see how that's done with tRPC or traditional REST APIs. My impression is that frontend would need a lot of back and forth calls to get the required data when it needs to call a lot of different microservices while with GQL, Apollo Gateway does a lot of the magic for you. Some of our microservices are also Java/Kotlin so GQL definitely benefits us here.
@galer7
@galer7 2 жыл бұрын
Would you say that GQL is more appropriate for building a large database API where different users want to fetch different fields? I imagine that using a more RESTish solution for this would result in having multiple permutations of fields. I personally find that the biggest benefit for GQL, but I don't hear a lot of people saying this. Also, when you described the microservices use-case, would you use multiple repos with semver in your package.json or one big repo for all?
@Nil-js4bf
@Nil-js4bf 2 жыл бұрын
​@@galer7 Each microservice is in its own repo. They all contribute a "subgraph". The apollo gateway is its own microservice which knows about all the other microservices and stiches all their subgraphs into one supergraph/schema. Frontend then fetches the schema from the gateway service to generate its types and make queries/mutations. GQL letting you avoid over fetching is nice but I recall some people saying tRPC lets you do it easily with Prisma. One of these days when I'm not lazy, I really need to take at that stack. That said there are some things with GQL we needed to be wary of. Authorization needs to be done at an entity level so you don't accidentally let a user see confidential info by querying for blogPost.createdBy.password or something similar. GQL is also a null first language but we didn't have a nice way of checking for nulls everywhere on frontend so we started marking fields as non-nullable a lot. We eventually realized that it's best to leave federated entities as nullable so when a small error in one microservice fails, your big query that fetched useful info from other microservices doesn't completely die so your frontend component can still show partial data.
@EzequielZacca
@EzequielZacca Жыл бұрын
You nailed. Saying truck is better means you are using graphql for the wrong reason
@moodynoob
@moodynoob Жыл бұрын
Thank you for this really good description of what tRPC is - I saw it around Twitter, but I didn't understand why it's useful. The issue of over using GraphQL is dear to my heart - I work in a large bank, and they've recommended that all BFFs default to using GraphQL. Although everyone was enthusiastic about it because it's a chance to learn a new framework, it's resulted in over-complicated codebases for very simple BFFs, and new devs struggling to understand and extend those codebases.
@x3gxu
@x3gxu 2 жыл бұрын
What do you think about REST with openapi/swagger schema to have that contract between a backend and frontend?
@michaelslattery3050
@michaelslattery3050 2 жыл бұрын
It would be cool to write a plugin for Next/Nuxt/Sveltekit so you could include your backend actions in components. So you could specify backend methods the same way you currently specify frontend methods. Even cooler if it could work with FaaS and hot-deploy both ends whenever you save your component source.
@SeanLazer
@SeanLazer Жыл бұрын
Kinda sounds like Remix
@Elliott_Ives
@Elliott_Ives 2 жыл бұрын
This video came at a perfect time. I have been wondering about this topic for a few days now. So, in a situation where a developer is writing an entire application (frontend and backend) and has complete agency over the database, it seems like tRPC makes the most sense, right?
@t3dotgg
@t3dotgg 2 жыл бұрын
Yep! There’s no way you can build faster and faster in full stack :)
@codenameirvin1590
@codenameirvin1590 2 жыл бұрын
That is super interesting point regarding being able to update your mobile apps on the fly like that with react-native.
@hhueston
@hhueston 2 жыл бұрын
6:58 Thanks for the shout-out Theo! :)
@cabrerabywaters
@cabrerabywaters 2 жыл бұрын
I started using openapi-trpc a couple weeks ago and it is really the best of both worlds. I had some issues related to "complex" nested types, but I managed to find a way around it (so far). Also, you can later go from open-api to protobuffs and use those types in other languages. 100% recommended, Give it a try!!
@vivarantx
@vivarantx Жыл бұрын
doing a tictactoe doesn´t expose you to the problems it can have, dont get hooked up too quickly to stuff
@voidemon490
@voidemon490 Жыл бұрын
@@vivarantx Did he mention he did a tictactoe?
@ShaharHarshuv
@ShaharHarshuv Жыл бұрын
We are adopting GraphQL in our company without almost no guidance or expertise, and I have to say - people just don't get it and it's getting messy really fast. And it sucks because the ideas of it is great, but for some reason people have a hard time making the correct mind shift and design the schema well
@mfpears
@mfpears Жыл бұрын
I worked for a startup that loved keeping frontend and backend teams separate, and none of the backend engineers knew how to make a good REST API, so they grabbed gRPC and proceeded to create ridiculously complex ways of saving and retrieving data. Endpoints had weird side-effects and things like pagination were treated like crazy features nobody expected. There's a reason REST was invented and took off like crazy. Web development was more like RPC before REST came along. I don't know if there's value in RPC above REST, but I'm strongly biased against it because of that experience.
@MarkVonBaldi
@MarkVonBaldi Жыл бұрын
I mean, correct me if i am wrong here, but every get/put/post etc is handled by a function in the backend that takes the params from the URL or body as its param. Knowing that, tRPC is just cutting the middle man and letting you just call that function from the frontend and I think you could maintain (for legacy purposes) both mechanism. What was the problem with gRPC exactly?
@mfpears
@mfpears Жыл бұрын
@@MarkVonBaldi I didn't say it was a technical problem. I said some engineers can use it to bypass learning how to make good endpoints for managing resources. It can be a crutch.
@MarkVonBaldi
@MarkVonBaldi Жыл бұрын
@@mfpears I suppose so.
@Anonymous-ib7dc
@Anonymous-ib7dc Жыл бұрын
@@MarkVonBaldi +1 will definitely happen
@praskrishna
@praskrishna Жыл бұрын
Theo, great insight on trpc vs graphql
@chrislacey89
@chrislacey89 Жыл бұрын
We used JRPC an my previous company. Our back, and was written Node, then got rewritten and Go. I really like the simplicity of calling a function on the server. Any thoughts on JRPC?
@Khari99
@Khari99 2 жыл бұрын
I'm the Flutter developer that won't let go of their ways lmao. Subscribed so I can refresh my knowledge for the React side of dev. Love your channel! I have already learned so much
@aristide_F
@aristide_F Жыл бұрын
Hello Theo. I love thé idea behind t3. Especially because all the stacks there are those I feel quite comfortable with. Given that NextJs is a Fullstack framework. If I want the next api be consumed by the mobile version developed in react native as well as the web. Is that pretty comfortable and easy?
@Gelo2000origami
@Gelo2000origami Жыл бұрын
If you can call it with postman/insomnia, it should work on mobile as well
@dixztube
@dixztube 2 жыл бұрын
I was critical on some stuff but great video and like I expected man when u get down to business - intelligent, great explanation. It’s like awww okay ya this is good stuff. Maybe I just caught some stream rants lol. Thanks 4tv !
@chopfitzroy
@chopfitzroy 2 жыл бұрын
Solid, too the point, and enjoyable :D great stuff as always
@codewithguillaume
@codewithguillaume Жыл бұрын
Very interesting. GQL seems to be still very popular though… Hasura with TRPC would be possible? 😉
@iamilyes
@iamilyes Жыл бұрын
anyone remember when rendering engines where a thing ( stuff like handlebars and thymeleaf ), React is a blessing (especially if you use TS)
@chaouanabil3087
@chaouanabil3087 2 жыл бұрын
did you try Odata and what do you think about it?
@timgerk3262
@timgerk3262 2 жыл бұрын
My users and managers care very little about backend, plus it is recurring cost and exponentially growing complexity. Stateful backends so easily become cupboards of horror! I'm going to watch, optimistic tRPC can be used ti mitigate some of those negatives.
@devagr
@devagr 2 жыл бұрын
Does TRPC even work well with Nextjs and Vercel (serverless)? I can't do a single router for all backend queries because then all my backend code will end up in a single serverless function which is horrible for performance, infact we are going through a big refactor just to avoid that
@t3dotgg
@t3dotgg 2 жыл бұрын
NextJS auto splits Serverless functions when the JS bundle breaks 100mb. No perf issues at all :)
@PandaNuker
@PandaNuker Жыл бұрын
had a question: is trpc a RPC framework? I know we get fullstack typesafety but do we get protobuff levels of speed?
@t3dotgg
@t3dotgg Жыл бұрын
RPC does not imply protobuf, it’s just “remote procedure calls”. So no, this is slightly slower than normal REST (it uses SuperJSON)
@PandaNuker
@PandaNuker Жыл бұрын
@@t3dotgg thanks;)
@0xO2
@0xO2 Жыл бұрын
Procedures that by definition don't return values or results call functions that return both...
@sky_kryst
@sky_kryst 2 жыл бұрын
I heard you say, 'those few use cases where typescript is very slow for your backend'. Being a junior and self taught dev, how would one differentiate between such usecases? I generally think if I have too complex data queries/ relations or the need to call my backend too many times on most of the pages, graphql is my guy. What such thinking should I apply on when to use TS or golang for a project?
@chilakachinedu2052
@chilakachinedu2052 Жыл бұрын
Nodejs in general, regardless of using typescript or just regular JS is not really great for CPU intensive tasks. If your product is mostly just fetching data from a server or doing most stuffs like Crud operations Nodejs is still your guy. Whether you are using graphql or regular Rest Apis
@yzeerkd
@yzeerkd Жыл бұрын
east-west (service-to-service) communication is generally where you might start optimizing for performance by picking a different language. your BFF (backend for frontend) sits between clients and other services, and is an example of north-south communication. You can generally get away with using node for your BFF in the name of using the same language on your front-end and its backend and the benefits that provides (e.g. shared validation logic using something like zod). Then you would offload CPU-heavy and/or ML workloads to some other service in an appropriate language (maybe Scala, maybe golang, maybe python-wrapped-performant-C++), ideally using grpc/protobufs/etc for communicating with those sorts of services. tl;Dr if you're just doing basic CRUD on the backend, you're not likely to need to switch languages for performance reasons.
@gamerzero6085
@gamerzero6085 2 жыл бұрын
I'm kinda confused by you saying that kotlin is "dated way" and it should be replaced by typescript. Also for the backend, JVM languages are just more comfortable to work with. Dynamic one, even with type system placed ontop, would probably never be as structured and well-though unless you do it from scratch.
@Lavender_1618
@Lavender_1618 Жыл бұрын
If trpc is just "calling a function on the backend". How is it different than just a rest api? Usually a rest endpoint is a function that does something to the backend. Or retrieves something from the backend. Isn't that just "calling a function on the backend".
@RogueTravel
@RogueTravel 2 жыл бұрын
I’m a Kotlin Android dev that you speak of, with React Native experience. I tend to agree with the attempt to share components between React Native and React web. My personal projects are all Typescript/React and I also use React Native, but I can’t deny the dev experience with Flutter is much better. But because Typescript allows me to hit multiple birds with one stone, I deal.
@AkshayKumar-kz6zh
@AkshayKumar-kz6zh 2 жыл бұрын
Brother you're on wring video IG
@lpanebr
@lpanebr Жыл бұрын
Building API version independent is amaizing. How do you do it?
@carljkempe
@carljkempe 2 жыл бұрын
I have been building a gqlgen backend with go and it’s been interesting thus far
@venicebeachsurfer
@venicebeachsurfer Жыл бұрын
Can you use tRPC when the front end is separate from the backend? What is the solution if the front is a react app that calls apis on a separate rails server?
@theArgonautics
@theArgonautics 2 жыл бұрын
Please try not to be too judgmental or arrogant about "your way". Kotlin is anything but a "dated way". And I say this as a dev who works with both (and also with GraphQL). Kotlin multiplatform can do much more and more effectively than what node/Typescript can do and I'd say that the language itself (Kotlin) is better too in many aspects. I use Typescript and node every day, and I like the tech, but calling Kotlin, Flutter or whaterver contemporary technology a "dated way" is not only plain arrogant, but it also says much about the knowledge of the person who says it.
@sproott1498
@sproott1498 Жыл бұрын
I've been looking into Kotlin for building APIs, but I like to make them type-safe. Is there a good way to make one in Kotlin? I know you can write a bunch of boilerplate annotations to document your API using OpenAPI, but I think it's better to generate it from the API code itself, e.g. from the controller methods and I haven't seen a robust way to do that in Kotlin.
@eltyo340
@eltyo340 Жыл бұрын
I'm a typescript purist, but genuine question: could you explain some of the use cases where kotlin is better?
@_____case
@_____case Жыл бұрын
@@eltyo340 You could re-write Apache Kafka, Apache Cassandra, Apache Spark in Kotlin, but trying to do that in TypeScript while achieving the same performance would be very difficult, if not impossible.
@ACHTech20
@ACHTech20 Жыл бұрын
Very accurate
@thebahrimedia
@thebahrimedia Жыл бұрын
It's content, it drives engagement (like your comment and mine). Nothing is meant to be taken as serious as it seems.
@anthonyoleinik6472
@anthonyoleinik6472 Жыл бұрын
This would be an interesting video for me since I am an average GQL enjoyer but am open to alternatives. But I immediately clicked off when your firsts words were “you need to have TS on the frontend and backend.” It’s just not feasible to tell all API consumers that they have to use TS.
@omri9325
@omri9325 2 жыл бұрын
How do you handle versioning with tRPC? We usually deploy the back-end and front-end at different times and prefer to have a small window of backwards compatibility between the two.
@yzeerkd
@yzeerkd Жыл бұрын
Treat it as an accreting API for the duration of any deployment -- give the new implementation a different name, preserving the original implementation at the original name. Once you confirm all clients are using the latest version, push a breaking change that makes the old name have the new logic, and have clients use the old name. Once you confirm all clients are using the latest version, remove the new name. Basically the same way you do a breaking db schema change without deploying a distributed monolith. Watch Rich Hickey's talk on how semver is broken for more on the concept of accreting APIs
@unsuspicious_youtuber
@unsuspicious_youtuber Жыл бұрын
So - if i have an app where i am bound to using python on the backend for (django), how would I get something similar to tRPC? I am currently just going to use GraphQL but is there any way to get a similar setup to T3 stack with a python backend? Is my only option for something that measures up to go typescript backend?
@t3dotgg
@t3dotgg Жыл бұрын
Python is not typesafe. You can’t infer types from a language that isn’t typesafe lol
@unsuspicious_youtuber
@unsuspicious_youtuber Жыл бұрын
@@t3dotgg Gotcha, was thinking of something like mypy for pseudo type safety but thinking about it I can see how that was a silly question, asked after a night of no sleep lol
@hipertracker
@hipertracker 2 ай бұрын
You can use Hasura, which creates a GraphQL endpoint out of the box without any effort.
@BosonCollider
@BosonCollider Жыл бұрын
I'm confused. What does tRPC do that I don't get from a rest API and something like openapi-typescript to generate frontend types?
@DiegoBM
@DiegoBM Жыл бұрын
It kind of feels like we are going back to the past. As if we noticed how stupid we were for wanting to change things, like CSR to SSR/SSG (although we now have hydration), or from Rest and GrapQL to RPC... I wonder if we will diverge from this again in the future. This might be like retro going back on style
@nyambe
@nyambe Жыл бұрын
Many Backends use legacy code that can't really be touched. Frontend on the other hand is always looking for latest and greatest. Graphql helps me merged both in a single endpoint for apps.
@DavidWoodMusic
@DavidWoodMusic 2 жыл бұрын
THEO GO TO BED Also stuck in GQL hell at work right now Great video Much love brother
@muhammedahmed1514
@muhammedahmed1514 2 жыл бұрын
So, if trpc is a single API route, can I call it in a Flutter app (just for example), or any other non TypeScript application, and get the data? Or is it that since trpc does not return JSON, I will be unable to do this?
@cecece775
@cecece775 Жыл бұрын
U will surely be unable
@engelshentenawy
@engelshentenawy Жыл бұрын
graphql is great for public apis, trpc no so much. trpc is great for internal apis, so is graphQL ( but requires more work ).
@t3dotgg
@t3dotgg Жыл бұрын
Yep! I’d say rest is slightly easier for public APIs, designing a GOOD public GraphQL api can be painful but it’s great if you pull it off 🙏🙏
@nuttButterAMK
@nuttButterAMK 8 ай бұрын
So tRPC is better than protobufs only if the client and server code are in the same repo, is my understanding correct? I'm sure we can use protobufs to generate client code.
@hugohabicht6274
@hugohabicht6274 2 жыл бұрын
It really hurts to listen to this because I'm missing out so much... At my company we're using untyped, untested and undocumented Javascript Microservices with mongodb.... Everything is a mess, we never really know what data we're gonna get... I would be so happy if I'd get any sort of typesafety at all... Even it weren't perfect..
@wata1991
@wata1991 2 жыл бұрын
Be the change you want to see. Just make sure you get compensated for doing additional work 👍🏼
@StarCourtesan
@StarCourtesan Жыл бұрын
Can you use tRPC with a graph database like neo4j
@landondepaul3491
@landondepaul3491 2 жыл бұрын
Thanks for the show
@RossPfeiffer
@RossPfeiffer Жыл бұрын
this shit goes so deep.
@greendsnow
@greendsnow Жыл бұрын
why not use strapi for GQL?
@forthesky1092
@forthesky1092 2 жыл бұрын
Great well explained !
@gonsfx1792
@gonsfx1792 Жыл бұрын
Why do you think the GitHub GraphQL API is bad? Would love to understand the criticism and see you point out the problems you see based on the experience you have
@Zeioth
@Zeioth Жыл бұрын
idk but I'm using graphql and I cannot define optional parameters for a resolver's input. So in the end... Lots of useless data traveling through the network.
@ambuj.k
@ambuj.k Жыл бұрын
Is tRPC good enough for mobile apps? because one of the points graphql makes is the fetch just what you want philosophy to deal with slow, unreliable and expensive mobile data on phones.
@ddomingo
@ddomingo Жыл бұрын
Dated ways? I love TS but calling other ways dated is silly. Java, C#, Python are still incredible tools for building modern backends.
@nicolasivorrani
@nicolasivorrani Жыл бұрын
Can you upload your video on Spotify or Deezer ?
@failist9570
@failist9570 Жыл бұрын
So its like gRPC with types?
@t3dotgg
@t3dotgg Жыл бұрын
Not really
@drizzletone9148
@drizzletone9148 2 жыл бұрын
The thing that bothers me the most with tRPC is the fact that you are selecting the query by simple string and this means no autocompletion. You can't just hit ctrl + space and see all the available queries. It can be fixed by using string-like enums but I feel that it can be solved in a better way.
@t3dotgg
@t3dotgg 2 жыл бұрын
There’s auto completion with the simple strings! Also v10 is moving to nested objects lol
@drizzletone9148
@drizzletone9148 2 жыл бұрын
@@t3dotgg That's actually great! Thanks
@mashambasystems8410
@mashambasystems8410 2 жыл бұрын
What are some excellent GraphQL educational resources? Or do you expect for tRPC to really mature quickly?
@fallart4580
@fallart4580 Жыл бұрын
i still can't get it. how can it be "the future" or "graphql killer" if it requires hard coupling frontend and backend (and omg monorepository for both), which is oblivious anti-pattern for any serious projects. Ofc it can take own place for small project, where small team is building both sides of application, but it will never kill or replace graphql or rest, until it does not have any out-of-the-box solution for projects, where frontend and backend are independent microservices
@fallart4580
@fallart4580 Жыл бұрын
and tbh deepkit rpc looks much more professional compared to trpc
@eltyo340
@eltyo340 Жыл бұрын
I think you've hit the nail on the head. The two biggest concerns in software design is coupling and cohesion. There's many benefits to tRPC, but the one big downside is a tightly coupled front and back end. Just depends on the project whether that tradeoff is justified.
@abal11
@abal11 2 жыл бұрын
tutorial on trpc
@nuttButterAMK
@nuttButterAMK 8 ай бұрын
with all the problems and anti-patterns that typescript has, using another language for backend is not a dumb idea. With highly distributed enterprise scale service ecosystems trpc won't work that well in my opinion. I personally don't enjoy coding in typescript. Golang is much more pleasant I think. Also a question, in cases where graphql is not necessary, can protobufs be used instead of trpc?
@user-tk2jy8xr8b
@user-tk2jy8xr8b Жыл бұрын
Isn't there GRPC for TS?
@CodeFun691
@CodeFun691 Жыл бұрын
yes, but TS people clearly like to lock themselves in the worst way possible so that they can use even more JS/TS. If any of these companies one day can't use TS/JS on the backend for whatever reason anymore, they are basically screwed and can do a full rewrite front to back.
@theyreMineralsMarie
@theyreMineralsMarie Жыл бұрын
I'll take a statically typed Backend with a well designed REST API over pretty much anything else.
@cyberkrypts
@cyberkrypts Жыл бұрын
I think, tRPC is goot fit for teams that mainly consists of full stack developers. graphql is more well suited for large teams that have separate devs for frontend and backend.
@adimardev1550
@adimardev1550 Жыл бұрын
i recently realized how graphql really just makes my life harder. it doubled my bugs, i have to fixed and refract code twice even with nexus. especillay when using it with prisma. i think i'm gonna trash graphql. i used to love it though for past few years but i finnally realized it's really not that usefull even with complex project.
@yamiteru4376
@yamiteru4376 Жыл бұрын
Both tRPS and GraphQL are still very inefficient because of HTTP and JSON. If we swapped HTTP with QUIC and JSON with some custom low-level and binary parser then that would be absolutely amazing.
@ThePapanoob
@ThePapanoob Жыл бұрын
so you mean like gRPC
@yamiteru4376
@yamiteru4376 Жыл бұрын
@@ThePapanoob Yup gRPC with a layer of some additional stuff
@ryana.9821
@ryana.9821 Жыл бұрын
This man is the cat's ass of quality content. Thank you Theo. Gg
@CodeFun691
@CodeFun691 Жыл бұрын
I just read a article from logrocket to understand what the actual difference to gRPC is and this is what they wrote: "While tRPC is indeed also a remote procedure call framework, its goals and basis differ fundamentally from gRPC. The main goal of tRPC is to provide a simple, type-safe way to build APIs for TypeScript and JavaScript-based projects with a minimal footprint" This has to be the stupidest reason to basically build a completely new "protocol", that is not a protocol and nobody else can use. So yeah, TS/JS people are one more time too stupid to use their own tooling and now need something like this because they can't properly deal with types, even though they already have the same data representation on the front and back-end.
@lukas.prochazka
@lukas.prochazka Жыл бұрын
This is nothing new. For example .NET's old WCF is based around this concept where you delcare an interface that serves as communcation contract. It's just creating an interface that will be implemented by your BE and then creating an object proxy on FE based on the interface. The interface's implementation becomes a controller and methods become actions with the proxy on FE serving as "smart fetch". The proxy can be generated or create at runtime using reflection. This can be generally achieved even in JS when using classes. However, this approach was eventually phased out as WCF got succeeded by ASP NET, but there are libraries that do this even for ASP NET. The tRPC seems like a downgrade as u still need to perform the tRPC call explicitly by using client.query('name', input). I think the better way to do this would be doing it as .NET did using OOP by explicitly using object (of the given interface) to perform call which would automatically map to it's implementation on the BE. You may argue that interface does not exist at runtime and thus cannot be introspected to generate routes and proxies, but you may use abstract class instead. By this FE does not have to distinguish whether the object performs HTTP calls or is just "normal" object. You may argue that there has not been anything like this in TS/JS, but I think that is generally because it died out before Node.JS was created. The benefit of joined versioning comes from the monorepor. No matter whever GraphQL, SOAP, REST etc... as long as it's a mono repo the versioning of FE and BE is joined.
@lukas.prochazka
@lukas.prochazka Жыл бұрын
Funny that when you write ASP NET with dot, youtube will auto delete your comment.
@t3dotgg
@t3dotgg Жыл бұрын
tRPC v10 is moving to the more object-y syntax you described here fwiw
@lukas.prochazka
@lukas.prochazka Жыл бұрын
@@t3dotgg One additional thing: The contract seems to be purely server-based in the current version of tRPC (declared by the BE). However there are certian situation where you might want to declare contract in FE code or even somewhere else. When using interfaces or classes they can generally be declared anywhere, even in different repos (and being shared using npm). One last thing: If ancient .NET banking software showed me anything. This approach is a good servant but a bad master as it completely kills of reusability of the API by non-compatiable languages. For example when we were building React FE, we had to create additional BE in .NET as TS cannot consume .NET interfaces and we were not brave enough to hardcode routes in the client (and other related issues like picking proper HTTP method, deciding whether put input in body or query strings etc...). In order to be a proper abstraction for communication this proprietary .NET framework did not expose anything that could be used to at least generate TS (like swagger doc, because swagger is REST specific which would limit this framework to only use REST). I think this has potential as router-and-proxy generator which can be configured for different communication protocols and scenarios (including swagger doc generator) to save time when language matches, but it should not prevent direct usage of the underlying communication protocol if necessary. So it's rather extend than replace.
@krccmsitp2884
@krccmsitp2884 Жыл бұрын
I wonder what the relation of tRPC to gRPC ist, if any?
@t3dotgg
@t3dotgg Жыл бұрын
Basically nothing in common
@krccmsitp2884
@krccmsitp2884 Жыл бұрын
@@t3dotgg Okay, So they just happen to have similar names? Thx for the info!
@PaulSebastianM
@PaulSebastianM Жыл бұрын
Your audio is -14.9 dB lower than it should be. I always have to turn up my speakers when listening to your videos and then have them blow my out of my chair when I start a new video by someone else :D.
@snatvb
@snatvb Жыл бұрын
what about unnecessary fields what will you get with query? GraphQL give me possibility to get only queried fields, also I can query two users by id with one query for example RPC needs not for communication only, this need to connect two parts of one application in network This is great solution for nextjs api part, but it's not GraphQL killer, because they cover different things
@riccardoesclapon549
@riccardoesclapon549 Жыл бұрын
As a consumer I would way rather have a GraphQL endpoint. Having singular API endpoints limits you to whatever the developer had originally intended, while crafting a good GraphQL schema can enable a much broader set of use cases outside of what was originally thought of, and avoid things like over-fetching. Really click-baity title.
@t3dotgg
@t3dotgg Жыл бұрын
Did you…watch the video?
@riccardoesclapon549
@riccardoesclapon549 Жыл бұрын
@@t3dotgg I did, and to your clickbait question of "Is GraphQL DEAD??" you gave a bunch of reasons and scenarios in which GraphQL is good. Also, it's really not that hard to interact with, both for devs and consumers, but ok. And you also talked about the stricter nature of tRPC; I've never heard of or used tRPC but based on your description that's how I understood it. If I misunderstood maybe correct me instead of being a dick? But title is clickbait af regardless, hate how youtube took away dislikes number so I know clickbait content like this to stay away from
@domw2391
@domw2391 2 жыл бұрын
Im still not a tRPC user yet. But can we take type safe advantage from tRPC while our app is not monolithic? Like in real world there would be microservices, multiple frontend repo, even microfrontend, blablabla and so on. In this situation, is tRPC still a good choice?
@oscarljimenez5717
@oscarljimenez5717 2 жыл бұрын
U can have a monorepo for all ur microservices.
@domw2391
@domw2391 2 жыл бұрын
@@oscarljimenez5717 May be it won’t be suit to my company. We separate all this for the ease of out sourcing , part time etc. it is supposed that the non full time staff won’t get the full source code. Seems Pretty hard for us to adopt it in this situation. May be next small project that we might try
@cuddlecake00
@cuddlecake00 2 жыл бұрын
Theoretically, all the tRPC client needs is the server's tRPC router type (which is the 'schema' the client will operate on, similar to how openapi clients can be generated from openapi specs). So if you find a way to publish the type as its own package, you should be able to import it with tRPC in a client app. Is it feasible? I don't know. But the cool thing is that no matter how many servers you would want to integrated with a single tRPC client, the amount of code running on the client is still the same. That's neat.
@domw2391
@domw2391 2 жыл бұрын
@@cuddlecake00 seems cool
@stevepond14
@stevepond14 2 жыл бұрын
tRPC looks cool, but it really needs a better name
@codenameirvin1590
@codenameirvin1590 2 жыл бұрын
Hard agree with the point about it being easy to use GraphQL to make hell. We use GraphQL a little bit at my company but we see no perceivable benefit from it and it just makes everything much more difficult.
@CoryMcaboy
@CoryMcaboy 2 жыл бұрын
A swift and kotlin client would be great for mobile dev.
@t3dotgg
@t3dotgg 2 жыл бұрын
Using tRPC in a language that isn't Typescript is literally just REST with extra steps GraphQL is the right solution if your clients are multi-language, even the creator of tRPC recommends gql for such
@dminik9196
@dminik9196 Жыл бұрын
No.
@moosegoose1282
@moosegoose1282 Жыл бұрын
hahaha love the flutter h8
@Moose__Juice
@Moose__Juice Жыл бұрын
RPC => REST => GRAPHQL => REPEAT
@amanueltigistu8268
@amanueltigistu8268 2 жыл бұрын
I have used GraphQL with Contentful CMS, GraphCMS & FaunaDB. I don't know how tRPC will Integrate with these popular tools. Also Note that GraphQL Server Frameworks like GraphQL Yoga & GraphQL Helix & tools like Envelop, Envelop Plugins & GraphQL Tools with GraphQL Mesh & GraphQL CodeGen & more... are making GraphQL DX Awesome. Please make more explorations to current situation before going online.
@HisokaXKuroro1
@HisokaXKuroro1 Жыл бұрын
You should rather compare tRPC with gRPC and then ask "Why tRPC?"
@pyakz6474
@pyakz6474 Жыл бұрын
I dont know anything except graphql Been using it since day one of employment 🥴
@JacobAnawalt
@JacobAnawalt 6 ай бұрын
TL;DR - If you're not using TypeScript in front and back-end, and don't have full code visibility, This Tool Is Not For You. Move along, Move along.
@DuyTran-ss4lu
@DuyTran-ss4lu 2 жыл бұрын
Cool
@greendsnow
@greendsnow Жыл бұрын
t3 uses Prisma... It's quite easy to go to GQL from there. Why bother with your tRPC?!
@t3dotgg
@t3dotgg Жыл бұрын
You should watch, like, any of my other videos if you want my thoughts in GraphQL as an automatically generated api 😂😂
@RaghuprasaadIyer
@RaghuprasaadIyer Жыл бұрын
Hey please don't swear
@witchedwiz
@witchedwiz Жыл бұрын
Graphql dead because you can get typescript coupling between frontend and backend? Yolo
@3v1lp1ngv1n
@3v1lp1ngv1n Жыл бұрын
"is GraphQL DEAD?? so..this requires type script on both the back end and the front end" lol good jokes
@cruzergo
@cruzergo 2 жыл бұрын
If you use Postgraphile, you dont need to write resolvers.
@oscarmejia8306
@oscarmejia8306 2 жыл бұрын
Based
@diegobraga3745
@diegobraga3745 Жыл бұрын
Your content is great but I need to speed up the video to 1.5 cause you speak so slow 😂 😂
@thepaulcraft957
@thepaulcraft957 2 жыл бұрын
I am using python as my backend very often and dont see why this should be dated or smth. If u r more comfortable with one or the other go and use it
@Atmos41
@Atmos41 Жыл бұрын
GraphQL -> perfect for a team of FE React devs and BE Rails devs. tRPC -> perfect for fullstack Typescript devs.
@scottgreen3703
@scottgreen3703 Жыл бұрын
Why you guys cussin educational videos? Its so unsafe to watch even educational next to our kids? This just push me to unsubscribe
@t3dotgg
@t3dotgg Жыл бұрын
I hope your kids can't read replies because this is fucking dumb
@alexandervu6015
@alexandervu6015 Жыл бұрын
tRPC will have a short lifetime. In real large companies, no one will commit themselves to a single technology. This has to do with the availability of developers, and above all that this technology is not the optimal solution in all areas. The RPC stack isn't new, and there's a reason it hasn't caught on.
The Truth About GraphQL
12:06
Theo - t3․gg
Рет қаралды 93 М.
You Don’t Need Kubernetes
15:40
Theo - t3․gg
Рет қаралды 84 М.
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 2,7 МЛН
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 15 МЛН
Пробую самое сладкое вещество во Вселенной
00:41
Haha😂 Power💪 #trending #funny #viral #shorts
00:18
Reaction Station TV
Рет қаралды 8 МЛН
GraphQL, tRPC, REST and more - Pick Your Poison
17:12
Theo - t3․gg
Рет қаралды 107 М.
This took us too long, I'm sorry
12:46
Theo - t3․gg
Рет қаралды 53 М.
Zod Goes Where TypeScript Can't
8:11
Theo - t3․gg
Рет қаралды 54 М.
From $erverless To Elixir | Prime Reacts
22:34
ThePrimeTime
Рет қаралды 96 М.
React + Servers = Confusion
20:30
Theo - t3․gg
Рет қаралды 40 М.
tRPC, gRPC, GraphQL or REST: when to use what?
10:46
Software Developer Diaries
Рет қаралды 70 М.
Moving Off React Native
20:50
Theo - t3․gg
Рет қаралды 176 М.
Do you REALLY need SSR?
18:15
Theo - t3․gg
Рет қаралды 160 М.
Heroku Is Dead, Here's What I Recommend
11:59
Theo - t3․gg
Рет қаралды 247 М.
Main filter..
0:15
CikoYt
Рет қаралды 8 МЛН
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 25 МЛН
Ждёшь обновление IOS 18? #ios #ios18 #айоэс #apple #iphone #айфон
0:57
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 1,6 МЛН
📦Он вам не медведь! Обзор FlyingBear S1
18:26