Can I still get features like SSR/ISR with this infrastructure?
Hi everyone, I need to understand a bit about SSR/ISR with this infrastructure I have built.
I was first wanting to understand security implications to scaling multiple apps for my frontend, serving the HTML/JS to the users, while they consume my master backend, with all of the business logic
13 Replies
I was wondering, can I still get features like SSR/ISR if in the client applications (E.g. App1 or App2 in the picture) fetch the data from my Master backend while still in the server?
Is there a better way t structure this?
SSR would be fine, ISR just depends on how you deploy. Looks like you'll be deploying everything on Vercel so that should all work.
You'd only benefit from those if you're actually fetching while server rendering though, from the looks of things your client would be doing fetching separately
For example, in my App1 I could have
Oh yea that'd be fine
gSSP and stuff doesn't care where you get data from
Humm. I see. But is there a better way to do things?
I mean I wouldn't recommend using gSSP but if you're going to then that will work
I am trying to structure one big backend that I can access from dfferent frontends. I basically have it structured already so that the clients (computers in the image) can access the master backend with trpc. Working fine
Yeah that sounds fine
Okay. Cool!
And @brendonovich, do you know if I can call my Master backend from my Apps using trpc?
(Serverless function calling another serverless function using trpc)
Technically yeah, it's all just fetch requests between servers. I'm not sure on the specifics of how you'd setup the tRPC clients
So, instead of that I would have something like
I mean, I think useQuery is a hook for react, so
But I'm guessing it can work. That's good to know.
It might just be as simple as initializing a vanilla client on the server
https://trpc.io/docs/client/vanilla/setup
Actually since you're server-rendering you might need the SSR helpers
https://trpc.io/docs/client/nextjs/server-side-helpers
I see
Thank you. I'll look into it later
For now I'm setting it all up so that I can have Auth working as well 😄