Server Actions high level questions (scale, request library, exposing to other clients)
1) how are you supposed to scale a backend if your business logic is in react components? if this was never the idea then what's the point of server actions bar the ability to make requests to the server without shipping js
2) what's the new meta for requests? i didn't see a successful trpc implementation yet, will that not fit in the new paradigm? just react query and sharing a zod validator?
3) do i avoid server actions if i plan to make mobile client that will also consume the api? in a t3-turbo way
4 Replies
1) define scale
2) you can use trpc, vanilla client, to use trpc itself inside the server actions, but soon enough should be a better dx-wise feature
3) yeah, server actions are the heavy nextjs feature
1) i mean already any middleware, business logic, permission systems etc. i'm having some trouble imagining putting in a server action
3) so the approach would be app router + serverless api
1) the server action is just an nice way of colocating your form endpoint, so middlewares, routing and all that still applies for any nextjs-like resource
3) you can make "core functions" and call them be on the server action or be on the serverless api
ok that's pretty helpful, thanks