Why I'm Finally Using This Next.js Tool Again

preview_player
Показать описание
For the third time I changed my mind about tRPC, a package that makes full-stack type-safety "easy" (setup sucks but is worth it).

-- my links
Рекомендации по теме
Комментарии
Автор

Jack's video became the comeback for tRPC

adamjames
Автор

Started a new project that uses the App dir. I saw Jack's video and implemented tRPC and eveything seemed to work pretty smoothly until I wanted to call protected routes from the server. For this I would need to pass in the context into the caller and at that point it seems to me like unnecessary extra trips and complexity when I can just isolate the db calls as seperate backend functions that are protected by the auth. I get the type-safety all the way through here since prisma is the source of truth as the db return. I'm still keeping tRPC for client-side stuff though, it's very helpful with all that it and react-query can offer with loading states and refetches, but, and correct me if I'm wrong or if you have a better pattern, but for serverside it seems best to skip tRPC if you have one or more layers of auth. I'm not using any Server Actions as they are in alpha but that might change things in the future as well. Anyway, good video as always Josh! Cheers

filipniklas
Автор

I think the fact that it supports RSCs now is a big checkmark to be ticked, which was kind of keeping me away from using tRPC before. Great video as always, Josh! Thinking if I should try switching back and trying it out again. Would be interesting 🤔

kavindesivalli
Автор

using tRPC requires hollistic adoption, but if you want incremental adoption of type safety for REST style projects, you can use swagger in conjunction with Rapini, RTK CodeGen, NSwag, OpenAPI Gen...

blackpang
Автор

Thank you, Josh! Your videos are amazing. Id love to hear what kind of production experience you have and how your videos help us! You’re the best, thank you!

JacoBoogie
Автор

To avoid the `any` return type for your data when using useQuery, I just create a server action and pass that as the query function. Great return types and error handling via useQuery, plus no need to define API routes!

developerpranav
Автор

so much love for trpc, they're doing so well

sebcuadros
Автор

what is you opinion on server actions looks like now you can call it inside a function and you will get type safety

MDKhan-wwtp
Автор

tRPC is pretty cool and it solves a lot of problems. But just because it's good doesn't mean we should always use it. In a lot of cases, making direct calls from Server Components is just as good, and it has a few other advantages too, like not having to call our own endpoint from the server. On the client side, I think Tanstack, implemented in tRPC, is a big improvement on the DX where it's worth using (if not just tankstack).

On the other hand, tRPC is a great solution for some cases, like monorepos or places where you need to share actions through endpoints in different environments. It lets you reuse all those routes without losing typing in the different environments.

tomirodriguez
Автор

So you uploaded a video about React-query. you said it is best! and I thought you gave up tRPC which give a big complexity on the project. Are you going to mix together for the next project? Ahh.. tRPC uses ReactQuery internally but is it perfectly supporting React-Query?

maverick-
Автор

Jack killed it, was so happy to see trpc on the app router

TheIpicon
Автор

damn i forgot we can server the api at the edge when using drizzle.
Does somebody know if I can set up tRPC in a Monorepo, that has an api app and 3 frontends (admin page, customer login, website).
I want do define the tRPC router in the API use them in the frontends.
Big thank you if you got some tips

balduin_b
Автор

I love tRPC. Do more videos on it if you can

gabrielbianchi
Автор

But what about your video previous video where you went away from tRPC by using Zod and other validators? Isn't that the same thing? Is it inference?

kupiina
Автор

Thanks for giving out your opinions again, one question, do u have the code you wrote for this particular demo?

RuslanGonzalez-oxvz
Автор

I get why trpc is useful. But since RSC why don’t you just fetch the data from the db (and auth …) within the component and hydrate the client with the data?

I used the next api only for 3rd party access lately.

xSkyeHD
Автор

why don't you just use server actions

onta.nicolae
Автор

so do the front-end and back-end have to stay in one app in order to get type-safety? can I use tRPC as OpenAPI and still get type-safety?

TheZhouh
Автор

Hello josh I wanted to ask what do you think of learning mern stack in 2023 ?
should i learn it or go with the newers trends and all ?

develop-with-faizan
Автор

Why do you use in react query loading state if in next js 13 exist loading file?

kacperkowalski
visit shbcf.ru