Brian
Brian3mo ago

Next.js App router

Hello, is there any official way to implement tRPC with app router, or is it still experimental, according to the example app repo I came across? Any guidance would be appreciated 🙂 Thanks.
5 Replies
FluX
FluX3mo ago
tRPC + app router is stable :) You can read here how to set up the client: https://trpc.io/docs/client/tanstack-react-query
Brian
BrianOP3mo ago
ty for that, only asking as it seems like their nextjs example repo has a giant banner that warns against using it in production.
Brian
BrianOP2mo ago
bumping this, https://trpc.io/docs/server/adapters/nextjs is this only required for pages router? Assuming with app-router, trpc/server and trpc/client are sufficient enough? especially if pairing with react-query?
Next.js Adapter | tRPC
tRPC's support for Next.js is far more expansive than just an adapter. This page covers a brief summary of how to set up the adapter, but complete documentation is available here
FluX
FluX2mo ago
Yeah, I think you only need that adapter if you want to set up tRPC in the pages router as API routes. If you're using the app router, just use the fetch adapter as described at the bottom of the page. If your tRPC is integrated into Express/Hono etc, you just need to set up your client in Nextjs
Brian
BrianOP2mo ago
cheers 🙂 awesome 😎

Did you find this page helpful?