Repository navigation
|
Hello! I’m using oRPC with Turborepo. The main server lives in the api folder, and the client is in the web folder under apps. Contracts are hosted in packages. So my structure looks like this: I would like to know how to make the setup described here work in this structure: https://orpc.unnoq.com/docs/best-practices/optimize-ssr#conceptual-approach |
Replies: 6 comments
|
This setup require api and web in the same server. If you don't know how I don't think I can help eighter. |
|
You can adapt the oRPC SSR optimization pattern to your Turborepo setup by following these steps:
This pattern lets your SSR logic call API procedures directly (no HTTP roundtrip), while keeping a clean separation between server and client code. If you run into issues with error handling (e.g., To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
|
Thank you for your reply! Both the api and web applications will run on the same physical server (same Node.js environment, separate Docker containers). I’m not asking about deployment details, but rather about the recommended way to wire things up with oRPC in this Turborepo layout. |
|
My setup is actually very similar to the one in this example repo: https://github.com/unnoq/orpc-multiservice-monorepo-playground/tree/main. In the example repo I didn’t see the specific wiring related to the optimize-ssr approach, so I was hoping for a small code pointer or recommendation on where you would put that SSR optimization code in a monorepo like this. |
|
@vinkovsky To clarify, this setup requires the client and server to run in the same process, same Node.js instance, same port, same container, etc. I was really surprised when you asked about using this setup with |
|
@unnoq Thanks a lot for clarifying this. That’s where the misunderstanding came from |
@vinkovsky To clarify, this setup requires the client and server to run in the same process, same Node.js instance, same port, same container, etc. I was really surprised when you asked about using this setup with
separate Docker containers.