T
TanStack7mo ago
fascinating-indigo

TSS with CapacitorJs how Server Functions know the prod server ip?

Hi everyone, just getting started with TSS and getting it up and running with CapacitorJs. I love isomorphic server functions, but have a question about how they would work in production for a mobile app. I understand the SF on the client proxies the request to the server to execute the function... But how does the SF in the client knows the actual IP of the production server where the SF is going to be executed? Where is this configured? On my dev server everything works seamlessly because I'm using Capacitor's server.url pointing to my local IP, but that is only for dev not prod... I read the Nitro docs, but can't find a configuration option where I set the actual production server IP. Thanks in advance for your guidance / comments.
No description
7 Replies
grumpy-cyan
grumpy-cyan7mo ago
This is interesting, I never considered this as a possibility. I would have just used Tanstack Router and built a separate server
fair-rose
fair-rose7mo ago
But how does the SF in the client knows the actual IP of the production server where the SF is going to be executed? Where is this configured?
right now it's just a relative path https://github.com/TanStack/router/blob/main/packages/start-server-functions-client/src/index.tsx#L9 this would need additional config options that don't exist yet but it's definitely doable can you please create a new github issue to track this?
fascinating-indigo
fascinating-indigoOP7mo ago
Thanks @Manuel Schiller for your guidance. Sure, happy to open a Github issue. That was my initial approach and use TSS Router / Query with a backend in Go / Rust...But when I saw the isomorphic server functions I thought it would be far more convenient on a single codebase (me being a single dev)
grumpy-cyan
grumpy-cyan7mo ago
So single code base but split build/deployment, with configuration to point to server
fascinating-indigo
fascinating-indigoOP7mo ago
Correct, and having the server functions defined right next to the frontend components is very convenient imo. First time raising an issue on TSS Github, should this be raised as an issue-bug or as an issue-discussion? Thanks
fair-rose
fair-rose7mo ago
make it a "bug" issue and we'll label it as enhancement then
fascinating-indigo
fascinating-indigoOP7mo ago
Done, https://github.com/TanStack/router/issues/3411 Thanks again for your guidance and congrats on the excellent work the TanStack team is doing.
GitHub
No config or fetch resource option for server function on client to...
Which project does this relate to? Start Describe the bug Today it's not possible to define the server information (host, port, etc.) or a fetch resource, for server functions on the client to ...

Did you find this page helpful?