skip to content
Tushar's Avatar Tushar Tripathi

SSR for dashboards and complex webapps?

/ 3 min read

Note: Ignore landing pages, blog posts and such for below, they’re much better covered by SSG and SSR.

The SPA vs SSR debate is a long one. Though I do see value in SSR for initial page load and RSC for some infrequent scenarios, I don’t really understand the push for doing more and more things on the server for any non trivial application. Some reasons -

  • The performance cost and network RTT for server rendering adds up quickly even if it makes the initial load faster. This is a recurring cost, unlike in Single-Page Applications (SPAs), where page navigations can be almost instant post initial load.
  • Static files are much easier to cache and serve from the edge. Running servers on the edge doesn’t make sense, as it increases the distance from the database. Once can perhaps create a bunch of read replicas(or use a hosted service), but that’s just more complexity and comes at a cost of reduced consistency guarantees.
  • Moving into the direction of local-first applications is definitely a better way to go. The user experience can be much better here, and the application can be made to work offline. There are mutliple out of box solutions like Clientdb and ReplicaCache but it’s not too hard to build one’s own custom solution either. The gains and user experience improvements are much more than what can be achieved by server rendering.
  • Caching and service workers can reduce the network payload for SPA to almost nothing. And though this comes at a cost of initial load time, it gives a much superior experience especially in places like India where the network is not very reliable and usually has a daily bandwidth cap.
  • I don’t want to see spinners and skeletons for apps I’m using daily. This is just much easier to achieve in a well done SPA. And there doesn’t seems to be any good way to avoid this in non SPA apps. The network payload with SPAs is smaller, and the initial load time is essentially nothing as long as it’s not the first time. The initial load time doesn’t really matter for this class of apps compared to the user experience of once things are loaded.

The only place I see server rendering making sense is for rendering sub-parts of the UI which will singificantly increase the bundle size if all dependencies were to be fetched, but would utilize a fraction of those dependencies. For example, rendering code snippets or showing a preview hover card for links, or link embeddings. For everything else SPAs can be made so much more faster.