Website Rebuild - Astro SSG vs. SSR


One of the things I really like about Astro is the options you get. Astro is a fantastic static site generator (SSG), which is what I use here, but it also provides you with the ability to run using server side rendering which is more like a traditional server model that many people are used to using.

Static side generator or server side rendering? What is the difference?

The short answer is using Astro as a static site generator you can create your website and generate all the HTML files on your home computer and then upload those files to a traditional web host and your website will be available. A server side rendered Astro website creates the HTML pages on the fly when they are requested.

It took awhile for me to get my head around this and here is why. This website is a static website BUT it is hosted on Cloudflare Pages. I don’t run npm run build and upload this static website, instead Cloudflare takes care of that for me. Cloudflare can also host a server side rendered website. So what should you choose?

Unless you are pulling content from an API or CMS most people probably don’t need a server side rendered Astro website. Static sites are extremely fast and are really much easier to create even using Astro. If however you are trying to create a website pulling content from an API or will create more pages than some hosting services can handle (for example Cloudflare pages has a limit of 20,000 files).

Categories: tech   astro   web tools