Luka
Luka4mo ago

TRPC with Turborepo Nextjs

Do you guys usually put trpc inside the nextjs project or have it outside as a separate package/service? I've seen some people put the whole trpc in a package of its own and just import the api object in nextjs from the package. wondering what are the advantages and disadvantages of the either way
1 Reply
Spark
Spark4mo ago
I have been following https://github.com/t3-oss/create-t3-turbo/tree/main where tRPC is in a separate package like you are saying, and it is hosted on Vercel with the Next.js app. I think the main advantage for a separate package is flexibility. If you wanted to decouple the tRPC API from the Next.js app later you could use the package in a separate tRPC app like https://ion.sst.dev/docs/start/aws/trpc/. This is more complex, but better with scale.
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - t3-oss/create-t3-turbo
Ion
tRPC on AWS with SST
Create and deploy a tRPC API in AWS with SST.