Next.js Discord

Discord Forum

tRPC recommendations?

Unanswered
American Wirehair posted this in #help-forum
Open in Discord
American WirehairOP
Hey guys, I see tRPC very often now. What would you recommend? Should I use tRPC? what are the main benefits of using it? currently, we have a monorepo with a web app using next.js and a backend app using hono.js

2 Replies

American WirehairOP
bump
Roseate Spoonbill
tRPC is great when you run a monorepo app, which will benefit from typed server params/responses between client and server. It gives you much more control than server actions, and is well integrated with things like react query.

When I would use it:
- when server actions aren't enough
- when there are no external api clients involved

Bear in mind, that you asked for opinions, so this is my personal opinion. I don't think there is straight use/don't use answer here, only what other people would do.

You mentioned hono.js backend, which suggests, that your server is detached from next app. You could merge them and incorporate tRPC. But if there are other apps using your api, I'd do tRPC only for internal apis, an leave public/exposed apis in hono, or rewrite them into route handlers in Next.