tRPC Client within Next.js but with external standalone server?

Hi, I have an old Next.js project that used tRPC and we're currently in the process of separating out the frontend and backend parts of it for various reasons. To reuse code, I was hoping to set up a standalone tRPC Server In that case, what's the recommended method of setting up a tRPC Client on the Next side? using @trpc/next or @trpc/react ? I tried (briefly) using @trpc/next and it was giving me issues around not having a QueryClient set - but im not sure if the react method is the way to go either.
1 Reply
Mapo Doofus
Mapo Doofus13mo ago
It’s been a minute since I used trpc but things seem to be the same. Yes you’ll use @trpc/next. I have an old repo with a fastify server here if it helps https://github.com/maybemaby/fastify-trpc-next.