Why do we even need tRPC? #56
-
First of all a big shoutout! It's a great boilerplate. ❤️ With DrizzleORM we already have typesafe db queries. Why do we add tRPC in-between? I think we can just leave it remove the whole tRPC layer. What am I missing? 😄 The only reason I could imagine is to make use of nextjs built in caching? I assume, we wouldn't cache the db queries with the caching of nextjs but it only caches http requests. Maybe tRPC builds some api calls under that hood so that we cache them in nextjs. But again, just assumptions here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Glad you found the boilerplate useful! I agree with you that drizzle already provides TS support for db queries and we could leverage server components and actions to build a complete app. But what I learned from my experience is that server actions are very hard to manage for medium to large scale apps. Then there's also issue with authenticated requests, role based access, cache control, handling errors properly etc. For an in-depth explanation, you can watch this video https://youtu.be/hp-z01yAaRU?si=n3ApmF3hwwg8Bx96 by Josh tried coding. N.B.: we've excluded tRPC from authentication flow so developers can remove trpc easily from the project if they want. |
Beta Was this translation helpful? Give feedback.
Glad you found the boilerplate useful!
I agree with you that drizzle already provides TS support for db queries and we could leverage server components and actions to build a complete app. But what I learned from my experience is that server actions are very hard to manage for medium to large scale apps. Then there's also issue with authenticated requests, role based access, cache control, handling errors properly etc.
For an in-depth explanation, you can watch this video https://youtu.be/hp-z01yAaRU?si=n3ApmF3hwwg8Bx96 by Josh tried coding.
N.B.: we've excluded tRPC from authentication flow so developers can remove trpc easily from the project if they want.