1

In Next js , when the cache is not available , Next js is going to SSR the page and show it (based on the prefered fallback approach true or blocking) .

I Wonder what approach does Astro js takes in this scenario .I'm going to create a dynamic blog website and users can create blogs rapidly .

Do I have to build the static pages each time or it's better to take Astro js SSR approach ?

Moein Moeinnia
  • 1,945
  • 3
  • 10
  • 26
  • @Lissy93 Astro does have [builtin SSR support](https://docs.astro.build/en/guides/server-side-rendering/) and supports a wide variety of runtimes & platforms – The Otterlord Apr 09 '23 at 17:12
  • 1
    If your are generating a lot of content, I'd recommend using SSR over rebuilding each time a post is created. For caching you can look into caching pages on a CDN when they're first requested. Check out the [SSR guide](https://docs.astro.build/en/guides/server-side-rendering) on how to enable SSR in Astro. You could also look into using a [Content Management System](https://docs.astro.build/en/guides/cms/) to manage the creation of posts across your team of potential writers. – The Otterlord Apr 09 '23 at 17:14
  • @TheOtterlord does astro ssr pages provide better performance than next js ssr? – Moein Moeinnia Apr 09 '23 at 18:05

1 Answers1

2

Astro does not cache the SSR, the rendering modes are fixed from the start

  • SSG Mode : all pages are static, so you need rebuild to update, not suited for a dynamic blog and permenent access to users.
  • SSR Mode : all pages are dynamic and built on fetch time.
  • hybrid mode : is SSR but you can fix some pages to be static.

It is possible to think of ideas and suggestions but for a clear answer to the question, Astro does not fallback on cache as there's no such Incremental Static Regeneration or Incremental build as of Today but could be something for the future.

The hybrid mode is quite useful when you have a highly dynamic site, and yet you want to have great seo performance on some pages that do not need to change like landing page or some fixed doc.

Note that after all the difference between SSG and SSR is the caching, so you could

  • CDN caching pages as mentioned by TheOtterlord
  • custom caching : you decide on your own which content does not require a new fetch and can be stored locally.

Custom caching, depending on your deployment you could do this in memory for maximum performance or in files, but these solutions can't run in serverless.

References

wassfila
  • 1,173
  • 8
  • 18