I am developing a Next.js e-commerce app with many pages, some of which are all-products page, specific product page, blog article page, profile page, cart page and many more. This app requires strong SEO, therefore I opted for Next.js, however, I do not have much experience with its data fetching options - SSR and SSG. I read many articles about SSR and SSG in Next.js, I am not sure if I understand it correctly though.
As I am new to this, I opted for getServerSideProps
for almost all of my pages that need to load content from a RESTful API before rendering. However, I came across an article that stated that the best option for the product page is to use getStaticProps
alongside with getStaticPaths
with fallback = true
and render a loading indicator if a certain page has not yet been pre-rendered. My app, however, changes data frequently, the database contains more than 10k products that are being removed, edited or added regularly. My first question is, whether the getStaticProps
and getStaticPaths
is a good option in this case. Will the product data be updated with every page view? Or do I need SSR for this? Customers always need to see the latest updates to the products. The same question goes for the all-products page, since it should only display products that are currently available and hide them as soon as they go out of stock.
My second question is about the deployment. I understand that if the app is built and exported statically, it can be deployed to static/shared hosting. However, if I use SSR in my app, I have to use a virtual server for hosting the app as far as I understand. Depending on the first question, what are the options for hosting such app?
Thank you very much for all your answers.