tRPC - GraphQL KILLER??!

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

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

  • @TomDoesTech
    @TomDoesTech 2 года назад +121

    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 2 года назад +4

      That is very interesting. The question for you Tom would be: would you leave GQL for TRPC?

    • @ogwurupatrick5641
      @ogwurupatrick5641 2 года назад

      @@codewithguillaume Apparently, he could.

    • @WarframeCrunch
      @WarframeCrunch Год назад +2

      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."

  • @universecode1101
    @universecode1101 2 года назад +39

    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 года назад +11

      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 2 года назад +17

    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 Год назад +1

      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

  • @Nil-js4bf
    @Nil-js4bf 2 года назад +20

    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 года назад +1

      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 года назад +5

      ​@@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 2 года назад

      You nailed. Saying truck is better means you are using graphql for the wrong reason

  • @theArgonautics
    @theArgonautics 2 года назад +76

    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 2 года назад

      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 2 года назад +1

      I'm a typescript purist, but genuine question: could you explain some of the use cases where kotlin is better?

    • @_____case
      @_____case 2 года назад +2

      @@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 2 года назад +1

      Very accurate

    • @thebahrimedia
      @thebahrimedia Год назад +1

      It's content, it drives engagement (like your comment and mine). Nothing is meant to be taken as serious as it seems.

  • @alefdoreu
    @alefdoreu 2 года назад +8

    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

    • @mariushn
      @mariushn Год назад

      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

  • @mfpears
    @mfpears 2 года назад +7

    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 2 года назад +2

      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 2 года назад +1

      @@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 2 года назад

      @@mfpears I suppose so.

    • @Anonymous-ib7dc
      @Anonymous-ib7dc 2 года назад

      @@MarkVonBaldi +1 will definitely happen

  • @cabrerabywaters
    @cabrerabywaters 2 года назад +3

    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 2 года назад

      doing a tictactoe doesn´t expose you to the problems it can have, dont get hooked up too quickly to stuff

    • @voidemon490
      @voidemon490 2 года назад +1

      @@vivarantx Did he mention he did a tictactoe?

  • @ShaharHarshuv
    @ShaharHarshuv Год назад +2

    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

  • @EricBishard
    @EricBishard 2 года назад +4

    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!

  • @codenameirvin1590
    @codenameirvin1590 2 года назад +1

    That is super interesting point regarding being able to update your mobile apps on the fly like that with react-native.

  • @iamilyes
    @iamilyes 2 года назад +1

    anyone remember when rendering engines where a thing ( stuff like handlebars and thymeleaf ), React is a blessing (especially if you use TS)

  • @timgerk3262
    @timgerk3262 2 года назад +1

    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.

  • @michaelslattery3050
    @michaelslattery3050 2 года назад +3

    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 2 года назад

      Kinda sounds like Remix

  • @ayoub.k
    @ayoub.k 2 года назад +1

    I watch your live streams, and I enjoy re-watching the cuts you post. Your content is pure gold! Thanks for everything.

  • @Lavender_1618
    @Lavender_1618 2 года назад +2

    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".

  • @moodynoob
    @moodynoob 2 года назад

    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.

  • @RogueTravel
    @RogueTravel 2 года назад +1

    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.

  • @anthonyoleinik6472
    @anthonyoleinik6472 2 года назад +1

    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.

  • @hhueston
    @hhueston 2 года назад +3

    6:58 Thanks for the shout-out Theo! :)

  • @praskrishna
    @praskrishna 2 года назад

    Theo, great insight on trpc vs graphql

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

    You can use Hasura, which creates a GraphQL endpoint out of the box without any effort.

  • @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

  • @Khari99
    @Khari99 2 года назад +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

  • @engelshentenawy
    @engelshentenawy 2 года назад +2

    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  2 года назад

      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 🙏🙏

  • @gamerzero6085
    @gamerzero6085 2 года назад +5

    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.

  • @nyambe
    @nyambe 2 года назад

    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.

  • @x3gxu
    @x3gxu 2 года назад +4

    What do you think about REST with openapi/swagger schema to have that contract between a backend and frontend?

  • @hugohabicht6274
    @hugohabicht6274 2 года назад +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 года назад +3

      Be the change you want to see. Just make sure you get compensated for doing additional work 👍🏼

  • @carljkempe
    @carljkempe 2 года назад

    I have been building a gqlgen backend with go and it’s been interesting thus far

  • @amanueltigistu8268
    @amanueltigistu8268 2 года назад +3

    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.

  • @Elliott_Ives
    @Elliott_Ives 2 года назад +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 года назад +1

      Yep! There’s no way you can build faster and faster in full stack :)

  • @theyreMineralsMarie
    @theyreMineralsMarie 2 года назад

    I'll take a statically typed Backend with a well designed REST API over pretty much anything else.

  • @codewithguillaume
    @codewithguillaume 2 года назад

    Very interesting. GQL seems to be still very popular though… Hasura with TRPC would be possible? 😉

  • @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.

  • @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 !

  • @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.

  • @ddomingo
    @ddomingo 2 года назад +1

    Dated ways? I love TS but calling other ways dated is silly. Java, C#, Python are still incredible tools for building modern backends.

  • @CodeFun691
    @CodeFun691 2 года назад

    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.

  • @gonsfx1792
    @gonsfx1792 2 года назад +1

    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

  • @mashambasystems8410
    @mashambasystems8410 2 года назад

    What are some excellent GraphQL educational resources? Or do you expect for tRPC to really mature quickly?

  • @chopfitzroy
    @chopfitzroy 2 года назад

    Solid, too the point, and enjoyable :D great stuff as always

  • @muhammedahmed1514
    @muhammedahmed1514 2 года назад +5

    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 2 года назад

      U will surely be unable

  • @stevepond14
    @stevepond14 2 года назад +1

    tRPC looks cool, but it really needs a better name

  • @nuttButterAMK
    @nuttButterAMK Год назад

    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?

  • @yamiteru4376
    @yamiteru4376 2 года назад +1

    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 2 года назад

      so you mean like gRPC

    • @yamiteru4376
      @yamiteru4376 2 года назад

      @@ThePapanoob Yup gRPC with a layer of some additional stuff

  • @Zeioth
    @Zeioth 2 года назад

    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.

  • @riccardoesclapon549
    @riccardoesclapon549 2 года назад +1

    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  2 года назад

      Did you…watch the video?

    • @riccardoesclapon549
      @riccardoesclapon549 2 года назад

      @@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

  • @codenameirvin1590
    @codenameirvin1590 2 года назад +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.

  • @DavidWoodMusic
    @DavidWoodMusic 2 года назад +1

    THEO
    GO
    TO
    BED
    Also stuck in GQL hell at work right now
    Great video
    Much love brother

  • @PaulSebastianM
    @PaulSebastianM 2 года назад

    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.

  • @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?

  • @lukas.prochazka
    @lukas.prochazka 2 года назад +1

    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 2 года назад +1

      Funny that when you write ASP NET with dot, youtube will auto delete your comment.

    • @t3dotgg
      @t3dotgg  2 года назад

      tRPC v10 is moving to the more object-y syntax you described here fwiw

    • @lukas.prochazka
      @lukas.prochazka 2 года назад

      @@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.

  • @PandaNuker
    @PandaNuker 2 года назад +1

    had a question: is trpc a RPC framework? I know we get fullstack typesafety but do we get protobuff levels of speed?

    • @t3dotgg
      @t3dotgg  2 года назад +2

      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 2 года назад

      @@t3dotgg thanks;)

    • @0xO2
      @0xO2 Год назад

      Procedures that by definition don't return values or results call functions that return both...

  • @omri9325
    @omri9325 2 года назад +3

    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 Год назад +1

      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

  • @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

  • @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 года назад +1

      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

  • @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?

  • @RossPfeiffer
    @RossPfeiffer 2 года назад +1

    this shit goes so deep.

  • @fallart4580
    @fallart4580 2 года назад

    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 2 года назад

      and tbh deepkit rpc looks much more professional compared to trpc

    • @eltyo340
      @eltyo340 2 года назад

      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.

  • @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 2 года назад +2

      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 Год назад +1

      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.

  • @chrislacey89
    @chrislacey89 2 года назад

    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?

  • @nuttButterAMK
    @nuttButterAMK Год назад

    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.

  • @aristide_F
    @aristide_F 2 года назад +1

    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?

    • @catholic_zoomer_bro
      @catholic_zoomer_bro Год назад

      If you can call it with postman/insomnia, it should work on mobile as well

  • @ambuj.k
    @ambuj.k 2 года назад

    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.

  • @dminik9196
    @dminik9196 2 года назад +1

    No.

  • @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 года назад +1

      NextJS auto splits Serverless functions when the JS bundle breaks 100mb. No perf issues at all :)

  • @chaouanabil3087
    @chaouanabil3087 2 года назад

    did you try Odata and what do you think about it?

  • @HisokaXKuroro1
    @HisokaXKuroro1 2 года назад

    You should rather compare tRPC with gRPC and then ask "Why tRPC?"

  • @pyakz6474
    @pyakz6474 2 года назад

    I dont know anything except graphql
    Been using it since day one of employment 🥴

  • @JacobAnawalt
    @JacobAnawalt 11 месяцев назад

    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.

  • @lpanebr
    @lpanebr 2 года назад

    Building API version independent is amaizing. How do you do it?

  • @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

  • @unsuspicious_youtuber
    @unsuspicious_youtuber 2 года назад

    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  2 года назад

      Python is not typesafe. You can’t infer types from a language that isn’t typesafe lol

    • @unsuspicious_youtuber
      @unsuspicious_youtuber 2 года назад

      @@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

  • @StarCourtesan
    @StarCourtesan 2 года назад

    Can you use tRPC with a graph database like neo4j

  • @greendsnow
    @greendsnow 2 года назад

    why not use strapi for GQL?

  • @abal11
    @abal11 2 года назад +1

    tutorial on trpc

  • @werghiaziz2943
    @werghiaziz2943 4 месяца назад

    now i understand the diff betwen u and prime... ,you are talk more in real situation or doing real staf about dev web

  • @user-tk2jy8xr8b
    @user-tk2jy8xr8b 2 года назад

    Isn't there GRPC for TS?

    • @CodeFun691
      @CodeFun691 2 года назад

      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.

  • @ryana.9821
    @ryana.9821 2 года назад

    This man is the cat's ass of quality content. Thank you Theo. Gg

  • @landondepaul3491
    @landondepaul3491 2 года назад

    Thanks for the show

  • @nicolasivorrani
    @nicolasivorrani 2 года назад

    Can you upload your video on Spotify or Deezer ?

  • @failist9570
    @failist9570 2 года назад

    So its like gRPC with types?

  • @cruzergo
    @cruzergo 2 года назад +1

    If you use Postgraphile, you dont need to write resolvers.

  • @krccmsitp2884
    @krccmsitp2884 2 года назад

    I wonder what the relation of tRPC to gRPC ist, if any?

    • @t3dotgg
      @t3dotgg  2 года назад +1

      Basically nothing in common

    • @krccmsitp2884
      @krccmsitp2884 2 года назад

      @@t3dotgg Okay, So they just happen to have similar names? Thx for the info!

  • @3v1lp1ngv1n
    @3v1lp1ngv1n 2 года назад +3

    "is GraphQL DEAD?? so..this requires type script on both the back end and the front end"
    lol good jokes

  • @witchedwiz
    @witchedwiz 2 года назад

    Graphql dead because you can get typescript coupling between frontend and backend?
    Yolo

  • @forthesky1092
    @forthesky1092 2 года назад

    Great well explained !

  • @RaghuprasaadIyer
    @RaghuprasaadIyer 2 года назад +2

    Hey please don't swear

  • @scottgreen3703
    @scottgreen3703 2 года назад +3

    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  2 года назад +1

      I hope your kids can't read replies because this is fucking dumb

  • @greendsnow
    @greendsnow 2 года назад

    t3 uses Prisma... It's quite easy to go to GQL from there. Why bother with your tRPC?!

    • @t3dotgg
      @t3dotgg  2 года назад

      You should watch, like, any of my other videos if you want my thoughts in GraphQL as an automatically generated api 😂😂

  • @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 года назад +1

      @@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 года назад +1

      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

  • @Atmos41
    @Atmos41 2 года назад

    GraphQL -> perfect for a team of FE React devs and BE Rails devs.
    tRPC -> perfect for fullstack Typescript devs.

  • @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

  • @moosegoose1282
    @moosegoose1282 Год назад

    hahaha love the flutter h8

  • @alexandervu6015
    @alexandervu6015 2 года назад

    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.

  • @oscarmejia8306
    @oscarmejia8306 2 года назад +1

    Based

  • @DuyTran-ss4lu
    @DuyTran-ss4lu 2 года назад

    Cool

  • @diegobraga3745
    @diegobraga3745 2 года назад

    Your content is great but I need to speed up the video to 1.5 cause you speak so slow 😂 😂