T
tRPC

In a monorepo can I have 2 packages each one with different trpc server, and use both in 1 app?

In a monorepo can I have 2 packages each one with different trpc server, and use both in 1 app?

IAAI am a Dev9/26/2023
I want to create 2 different APIs, and in my monorepo I have several apps, in some I want to use both, in others only 1 Thanks
V21Vic9/27/2023
Hey @I am a Dev I personally haven't tried this but it seems to me this is perfectly fine! You'd want to do this, https://trpc.io/docs/client/vanilla/setup for each API you want to use. Let's say you have API #1, and API #2. Then in App #1 you want to use both, you'd import the AppRouter type from both API#1 and API#2 and run the corresponding setup for each. Then say in App#2 you only want to use API#2, you'd only do it for that one. I'd also imagine you can get rid of some of the client setup redundancies across apps if you setup a shared package that sets up a client for each API and then the clients can be shared amongst your other apps and used as needed!
AKAlex / KATT 🐱9/27/2023
https://github.com/trpc/trpc/tree/main/examples/soa if you want the apis deployed separately but glue them together in the client you can use this approach

Looking for more? Join the community!

T
tRPC

In a monorepo can I have 2 packages each one with different trpc server, and use both in 1 app?

Join Server