-
|
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 |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
-
|
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. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
-
|
@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 |
Beta Was this translation helpful? Give feedback.
-
|
@unnoq Thanks a lot for clarifying this. That’s where the misunderstanding came from |
Beta Was this translation helpful? Give feedback.
@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.