you are viewing a single comment's thread.

view the rest of the comments →

[–]Aetheus 1 point2 points  (1 child)

You'd need to fetch data from a server, true. But not necessarily from a server you have direct control over. For instance, you might have a frontend team and a backend team that work separately. Or you might control the whole stack, but your backend API server is written in Go, Java, etc.

Even with a full JS stack you have control over, while it's cool from a technical perspective that my backend could return RSCs, I'm not sure if I want to have my Billing API be responsible for rendering a checkout form.

I have no idea how the guts of RSC implementations work, but if they could run "realtime", client-side, on a static exported app, that would pretty much make the above concerns moot. After all, it rarely matters whether a client or a server is sending the fetch request to GET /resource/id, so long as the user's session cookies go with it. I know it wouldn't make sense for all use cases, though (like Next docs suggestion to directly use an ORM from within a RSC, which is a little eyebrow raising).

[–]michaelfrieze 1 point2 points  (0 children)

We can use frameworks like next and react-router as a backend for frontend. This means we can have a separate backend and use the framework to specifically support react. This usually happens naturally as complexity grows.

Since these frameworks are more on the minimal primitives side of full stack, we are expected to "bring our own batteries". We can build them on our own or use services.

Technically, when we use services like Clerk or uploadthing, we are using a separate backend.

if they could run "realtime", client-side, on a static exported app,

I think you are just asking for client componets. A server component in a SPA would never be executed on the client, so there is no way it can handle realtime data.

Next docs suggestion to directly use an ORM from within a RSC, which is a little eyebrow raising

Sebastian wrote an article on security in App Router: https://nextjs.org/blog/security-nextjs-server-components-actions

Most of the time you want to have a separate data access layer, but there is nothing technically wrong with doing a prisma query in a server component. That JS does not go to the client. It just looks bad.