Yiannis
Explore posts from serversIs having multiple tRPC instances in a single monorepo package an anti pattern?
Hi there!
We are currently refactoring a large monorepo and we are torn on deciding the best approach in terms of trpc.
We used to have two monorepos we are now merging and it seems to make sense to now have a single package for trpc.
What would be the best approach for this?
So far we tried making one big “appRouter” but since we are emitting type deceleration files for our internal packages for performance we came across an issue merging the two trpc.router instances (where each one has a lot of objects that satisfy TRPCRouterRecords) so we decided to try making two trpc instances in the same package each with their own contexts and app routers.
Would that be considered an anti pattern and if if so what would be an optimal approach in a situation such as this?
(For the record we will be merging the two instances eventually but want to do this incrementally)
Many thanks in advance for your time and for making trpc so awesome!!
2 replies