Don't Migrate To tRPC

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024
  • I love tRPC. I don't think you should go rewrite everything to try it. ❤️
    #t3stack #fullstack #webdevelopment
    ALL MY VIDEOS ARE POSTED EARLY ON PATREON / t3dotgg
    Everything else (Twitch, Twitter, Discord & my blog): t3.gg/links

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

  • @moneymayhem2000
    @moneymayhem2000 Год назад +338

    Clickbait / manipulative content is destroying RUclips

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

      its so annoying it makes these people all useless to listen to...blocking this channel from now on.

    • @AstroFusion369
      @AstroFusion369 2 месяца назад +1

      Even if i have subscribed to this channel, we should DISLIKE those video to discourage such cheap strategy !

    • @mou2173
      @mou2173 9 дней назад +1

      He really said do not migrate your existing projects to tRPC otherwise he encouraged us to use tRPC in our future new projects

    • @ArjoRoy-pe6tf
      @ArjoRoy-pe6tf 5 дней назад

      It isn't clickbait. *Migrating* to tRPC and *creating* a project in tRPC is different. Perhaps you were thinking of the latter one.

  • @taylorswe
    @taylorswe Год назад +111

    This probably goes without saying, but I'd thought I'd mention it. Doing a major overhaul to a codebase could introduce a lot of question marks about your app's stability. So, when I'm creating a new feature, I'll also refactor an old one, then kick it out to prod and watch them carefully. Slow and steady, rinse and repeat...

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

      This is very true. Incremental refactoring also has the benefit that you're more likely to think about choices that you and your team makes, such as what kind of abstractions you need, what kind of performance to aim for, based on real stats and how important these features are to your product and users, compared to the time and effort you put into it.
      Major rewrites works very rarely (if at all) and often results in crunch, creating new and unknown problems that makes you to stay up all weekend. Not good for your mental health and work-life balanace, and not good for the business, because it most often that not does not result in more revenue.

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

      ​@@dealloc Refactoring and rewriting aren't always the same thing. Incremental rewrites also have their own issues. You might require a bunch of "interop" code to make old and new code work together and that adds its own problems, mental overhead and potential constrains.
      I do agree that rewriting for the sake of rewriting just because you love some other technology more is usually a bad move on a larger codebase. On a smaller project with minimal impact it's very doable just because the amount of features and code is just smaller.
      What Theo has shown here it looks like he had something like 20 API endpoints and that's really not a lot. That's easy to migrate, especially since it's just Typescript code before and after and it's all logic code because it's backend (no UI code). It would be a different story if it was about migrating from Go/Python/C# to Typescript.
      Migrating UI code (frontend) on the other hand is a whole different topic as far as I'm concerned.

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

      @@rand0mtv660 I agree with a lot you said here.
      Where I disagree is assuming that 20 API endpoints isn't a lot. Endpoints are abstractions and they most often than not, hide a lot of complexity underneath; middleware such as authorization, telemetry and analytics as well as integration with other systems which may not be trivial to easily rewrite for, even at the API level. And as we agree that rewriting just for the sake of it is a bad move, then you would just spend time on moving from one tech to another without improving the initial problems with the existing tech.

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

      If switching from REST to tRPC is a "major overhaul" then it's architectured wrong. REST/tRCP/GraphQL are an adapter layer, they *should be* totally swappable. It's actually trivial to migrate when you encapsulate business domain in Use Case driven development without polluting it with any framework/infrastructure stuff.
      That aside, its trivial to make these work side to side with regular REST first and create new /trpc endpoint) rather than break it all for the clients. Again, make sure that your business logic is properly independent of frameworks and infrastructure stuff and that'll be easy.

    • @rafaelrocha3991
      @rafaelrocha3991 Месяц назад

      That’s iterative refactoring, one of the key takeaways of the refactoring book by Martin Fowler

  • @plexq
    @plexq Год назад +16

    I'm a pretty old-school guy, most of my back-ends are written in Scala/Play framework and front-ends in React/Typescript. I love how Honest Scala keeps you if you do it right, and how solid the solution you build tend to be - borderline bullet-proof. I have to say, as the Typescript stack has matured, I'm seriously considering if I should be taking more of a deep dive into tRPC based solutions (where it makes sense). I think for me, Typescript is the new hotness that Scala wishes it could be to a large degree. And this RUclips channel has already clued me into plenty of libraries that really help connect the dots in a great way. So thanks for that - I recommend this channel to everyone I work with who cares about React/Typescript stuff.

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

      I think Typescript would be more enjoyable for me if I had never used Scala. The combo of algebraic types and string literals as types in TS makes it possible to do pattern matching and gives great type inference on union types. That being said, after using Scala on a project I now find tagging every union type in TS to be tedious. But I totally agree with you, I think the modern TS stack is incredibly developer friendly and makes programming very enjoyable (Zod alone has changed the way I handle type safety across the whole application). But when I'm having to bring in Immutable.js as a dep or manually tag union types I do feel myself missing Scala.

  • @MattChinander
    @MattChinander Год назад +21

    I've migrated my large REST API over to tRPC because of the end-to-end type safety, client code generation, and better developer experience. However, I still have kept some traditional REST endpoints around for non-JSON data purposes, such as file uploads and XML responses (RSS feed). tRPC doesn't solve every problem but it solves 99% of them and I absolutely love it.
    Doing the migration, however, I kept a lot of RESTful API design implementation around so that my frontends can keep working as-is (just swapping in trpc/client) with the same data model and structure. My next step is to rethink the "endpoint" (function) designs to better align with this new world and not be coupled to RESTful standards.

  • @PyroFire-Firework_is_a_passion
    @PyroFire-Firework_is_a_passion 10 месяцев назад +1

    Spot on! Watched this at 9 AM, coded non-stop until 3:15 AM, and now my project's transformed from REST to tRPC.

  • @LuNemec
    @LuNemec Год назад +24

    While the trpc may be super great dev experience, you are basically locking yourself to typescript only for backend and frontend. Thus making any future migration to different backend technology very costly. Since you cant just reimplement one backend endpoint at a time using different tech.

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

      What's preventing you from reimplementing one endpoint at a time? Also how is that different from other API tech like GraphQL?

    • @alanmartin528
      @alanmartin528 Год назад +3

      @@s4chinraja I think he means because of the programming language. You can write graphql apis and rest apis in other languages like Go, C, Python etc.
      But, it would still take a while... I think.

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

      @@s4chinraja tRPC is typescript only if I get it right? That means you'll have to 1st rewrite the BE endpoint, then rewrite FE to use different tech, and then switch over. Compared to using protocol that is lanuage-agnostic, where you would just switch FE to new implementation using same protocol.

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

      @@LuNemec Using tRPC most often comes with the decision to also use react query. So even if BE endpoint is rewritten in another technology, as far as the new endpoints can be consumed by react query (which will most probably be), your FE won't change much.

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

      @@hyunchae1093 Yes, so it is plain JSON as usual. But then you basically loose any advantage of using tRPC - like type safety. Might as well use gRPC to have schema type safety, cross-language compatibility and a little efficiency bonus.

  • @TomDoesTech
    @TomDoesTech Год назад +16

    Hey, you're the guy from the Destiny videos!

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

      tom do you know any way to use trpc in next js 13

  • @froxx93
    @froxx93 Год назад +12

    When migrating to trpc, doing it step by step is a good idea. Especially in regards of stability. But when you start using trpc, like it, and keep on using it for new features, keeping the old graphql, rest, etc api in the long term is not a good idea imo since you have different approaches to request / send data for different endpoints. I'd prefer having a unique way for that in the long term

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

    Not sure about other languages or frameworks, but no one I've talked to that uses Ruby on Rails would feel this way. tRPC is much harder to use than Rails. Here are lots of reasons why; be aware the scale or my perspective is very large projects not Google size, but Medium Enterprise CRM size.
    Ok here is why:
    1. tRPC's nested routing and routing in general. The structure isn't noisy and hard to discern. This is an area that needs to be memorized-ish on any project since the names are not always so obvious. It's just delay and cognitive load. I spend zero time in Rails on this problem. People will say "Roger, but you have a single file with all the routes and it's noisey". That's true, but due to conventions I open and file and can immediately without thought find what I need anywhere in the file and that's on bad projects done by weak devs.
    2. Testing! Postman nor any other tool like that makes little to no sense, since setting up any routes is massively time consuming and wlll often run afoul of some procedure. It's hard graft just to do something that any RESTful API can do in 5-10 seconds. In development cognitive load is a huge cost on development.
    3. Bug fixing: So you are clicking a button and you don't see a route or anything. No console log? Oh well. You are lucky if the developer created any kind of URL that will even hint at where that call is being responded to within your procedures and where it is based on a button click. This is one of the worst aspects of tRPC.
    I'm tired of griping, so I'll stop, but honestly if you are a nodeland user and haven't tried anything outside that ecosystem, then learn Rails and you'll see what I see.
    Also I really don't know why people think Typesafe code is such a huge thing; Github and many other large critical applications are written in Ruby which isn't typesafe. Typesafe is a nice to have, but good tests, that are easy to write and easy to reason about are more valuable.

  • @noamisaac
    @noamisaac Год назад +3

    What's ya'll's opinion on the usage of tRPC in a non-monorepo context (i.e. via publishing a private package)?

  • @2penry2
    @2penry2 Год назад +1

    One ergonomic benefit of tRPC that I've not seen many people praise is the component level SSR data fetching story.

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

    I migrated my whole app to tRPC in 3 days. Worth it! Was super annoying but new endpoints are much better.

  • @kazuma9496
    @kazuma9496 Год назад +3

    No fkn way dude, my man changed his whole personality

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

    Honestly great advice.
    I'm just starting to use TRPc and it was a bit of a ramp up initially, if I had gone in trying to migrate everything it might have become a blocker. I'm now using it though and can't see going back to REST anytime soon.

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

    I think the question that's getting dodged is whether or not tRPC will become obsolete if RSC / Next 13 becomes the meta for full stack app development. I have played around with the t3 stack and I love the ergonomics of tRPC, but I also love the ergonomics of Remix and the Next 13 app directory. What is the optimal path for full stack apps and DX? Am looking forward to seeing how things shake out!

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

    I like what I see from tRPC but I'm currently not using a monorepo. The code reusablitiy from the monorepo also looks attractive to me. What are your thoughts on moving from distributed repos (some for multiple different front ends and microservices backends) to a monorepo?

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

    i literally decided to learn trpc today 💀💀

    • @ArnoldsKtm
      @ArnoldsKtm 19 дней назад +1

      you've missed the point. it's fine to use it.

  • @zoffy3750
    @zoffy3750 7 месяцев назад

    TLDR: trpc is addictive, it has a very strong inhibitory response.

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

    "Chance's R..." is a great country western club. tRPC is great if you can make the rest of your org happy.

  • @joshuaborseth
    @joshuaborseth Год назад +3

    The t3 stack has spoiled me and now I don’t wanna work with anything else haha

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

    Another great video as always.
    Guys, I am looking for a job that uses T3 stack.
    Any recommendations on where to look?
    Thanks in advance

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

    but if it lets me migrate off of useSWR I should definitely migrate the one Page that's done before starting the next one I just started writing the SSG for, right? :)

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

    @t3dotgg can you tell me that if I have a standalone next js application why do I need trpc, i'm asking this because the real benefit of using trpc is that you can have better client-server communication but with using getServersideProp and other similar function we can do the same. And the trpc endpoint can't be treated as rest endpoints. So lets say in your ping app what is the significance of using it instead of something like getServersideProp ?

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

    That's what I thought. tRPC is useless if you are not using the same repo for both your FE and BE and if you are not using Typescript. Add It forces you to use React-Query. WTF!

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

    love ur videos ,man u r just an inspiration to me ❤

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

    How did you approach real-time chat in trpc?
    Websockets or polling?

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

    Your hair is amazing!

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

    can you do a video explaining the server$() function in solid start compared to the functionality of tRPC?

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

    Hey guys you think it's a jump of concepts learn trpc befor learning graphQL?

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

    It is possible to hace the client tRPC on a React app running on a Kubernetes pod and the server tRPC on a BFF running on another pod?

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

    First time I’ve been early to a video!

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

    Is this still relevant or can I ignore? Considering t3 stack is in love w trpc.

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

    Subbed to learn so thank you dude 😎

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

    this is a cute bag but i would never wear this no i would not

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

    Which cms I can use in t3 stack?

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

    You have amazing content, but why your video titles sound sarcastic :(

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

    2:27 - finally, the "slower" form of content pays off - Theo of yesteryear wouldn't even mention the possibility that there are shops that have their BE teams using other languages (also, love you mention Go / Python but not mentioning the most widely used language in enterprise / public sector land). Nonetheless, great video.
    Please more type of "slower" content, no need to go ballistic on every topic. Aspire to be Jack, not Prime.

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

    Whats the best way to share types when you’re client and backend is not in the same repo?

    • @kubagrott
      @kubagrott Год назад +3

      In my company usually types are generated based on swagger schema for rest api and on graphql schema for graphql. I'm leaving comment for starting discussion. I'm really curious is that good way, or there is better solution.

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

      @@kubagrott Yeah we do that as well where I work, but that's because our endpoints are .NET, so C#. Not really a way to import those directly into Typescript without a codegen step. We use "swagger-typescript-api" npm module to generate all types and an HTTP client class from Swagger/OpenAPI schema. Works really really well I gotta say. You just run a single command and get everything. This improved our developer experience 10x while working with endpoints that our backend developers create.
      This approach allows backend devs to use C# which they really like and us frontend devs continue using whatever we love. Even if we didn't do it that way, Swagger/OpenAPI docs that get created are really useful as API documentation in general, not just for generating Typescript types.

  • @RobertScott-Buccleuch
    @RobertScott-Buccleuch 6 месяцев назад +1

    The content is good, the title is horrible.

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

    i write my backend in rust, so no trpc

  • @fcnealvillangca7943
    @fcnealvillangca7943 9 месяцев назад

    The only reason im using typescript is for frontend other than that i hate js/typescript

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

    What's the way to add rest to it? Like integrating an existing API.

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

    Theo 사랑해💚

  • @Luis-kg5gm
    @Luis-kg5gm Год назад +2

    He's just talking nonsense :)

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

    Can tRPC Endpoints be externally consumed (outside of the Next.js App) for e.g. a Python script?

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

    @dosomecoding
    1 second ago
    theo do you know any way to use trpc in next js 13

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

      It works fine! Do you mean the /app directory?

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

      /app directory is main problem. i want to migrate

    • @t3dotgg
      @t3dotgg  Год назад +5

      @@dosomecoding we’ve got a long time til that’s viable because react context doesn’t work over server components 😅

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

    Please make a video of how to implement trpc with the next 13 app folder 🙏

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

    I've seen a few out there, but anybody have a good recommendation for a T3 or tRPC tutorial?

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

      tRPC only. Jack Herrington is pretty solid choice for tutorials ruclips.net/video/Lam0cYOEst8/видео.html

    • @alastairtheduke
      @alastairtheduke Год назад +5

      Look through the basic examples on the trpc docs. It really is 2 files, you don't even have to worry about a web framework (no express no nothing) just a client and a server (the built in one that comes with trpc for dev testing). Reading through the trpc docs feels like a tutorial. I'd start there.

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

      @@alastairtheduke it is possible to use tRPC front and back on separate Kubernetes pods?

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

      @@paulomirandaarias9544 That I do not know as I have no experience with Kubernetes.

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

    This is the way Theo! Sub 4 mins video with no BS, don't get me wrong I really appreciate your content but my time is precious and limited.

    • @seyadeodin
      @seyadeodin Год назад +5

      Idk why, but people saying time is precious on youtube commentaries always rub me on the wrong way,.

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

    Why don't we talk about module federation?

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

    just do a full rewrite.

  • @programmingterrain1244
    @programmingterrain1244 5 месяцев назад

    I just subscribed

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

    Is frontend and backend written in TS? Yes? use tRPC, else don't. Simple.

  • @UwU-dx5hu
    @UwU-dx5hu 9 месяцев назад

    I love this video❤

  • @ak-loz
    @ak-loz Год назад +2

    Teach us how to understand this stuff so well.

    • @rand0mtv660
      @rand0mtv660 Год назад +7

      Experience as time goes by and trying out stuff. That's really it. Just watching videos or reading blogs posts, but not actually trying out stuff will only get you part of the way there. Experimenting and forming your own opinion will allow you to improve more.

  • @mr.random8447
    @mr.random8447 Год назад

    does trpc work with golang

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

    not gonna lie, You are getting better at writing eye-catching titles. 😂

  • @1998goodboy
    @1998goodboy Год назад

    I'm literally gunna u sub bc you always try to guilt trip us into subbing and liking lol. The good vids will get recommended to me by the alg anyways

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

    First🤫

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

    Have you looked at gRPC? Support across many languages!

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

    this dude changes like the tailwind