Comparing SPAs to SSG and SSR

Click for: original source

What are the differences between Single Page Apps (SPA), Server Side Rendered Sites (SSR), and Static Site Generator based sites (SSG)? How do they compare in performance, SEO, developer experience, and flexibility? In this article, we give you an in-depth comparison of SPA, SSR, and SSG to help you make an informed decision on which strategies to use for your next front-end project. By Jacob Jackson.

The three different strategies have unique architectures. Often, if you are using a JavaScript framework, the simplest approach is to make a single-page app (SPA).

The article then explains:

  • The three strategies to JavaScript app development
  • When to use each approach
  • Performance
  • SEO
  • Flexibility
  • Ease of development

To ensure a good user experience, your website needs to be fast. Some approaches are faster than others. In general, SSG sites and SSR sites are faster than SPAs in terms of loading content. SPAs, as mentioned earlier, need to download the JavaScript for the app before they can display content.

However, in some cases, SSG and SSR can be slower. Because the server sends the HTML along with the JavaScript, there is a certain amount of duplication in the code. This means that the overall downloaded file is bigger, making the Time to Interactive (TTI) slower. Regardless of this file size increase, SSG and SSR will usually get better performance because of the faster content loading time. Another thing to note is that SSR sites can sometimes be slower due to the files needing rendering on every request. However, this can be mitigated by using strategies like edge computing.

Each approach to building a website with a JavaScript framework has its pros and cons. SPAs are best for heavily interactive apps where JavaScript is essential, and development resources are limited. SSG sites have the best performance and are good for sites with purely static content like marketing sites. SSR is good for more advanced sites that use more dynamic data without using client side JavaScript. Nice one!

[Read More]

Tags frontend css web-development angular javascript nodejs react