The original question was posted at Github discussion. But no one has answered the question yet. So let's try my luck here.
Context
I am trying to build a platform (a.k.a. web-2.0) website, where users will create the majority of the content, say like Ebay. I have decided to use useSWR
to fetch the user-specific data after a page is loaded. Now I am choosing between getStaticProps
and getServerSideProps
for loading the cacheable and SEO-able page skeleton data.
getStaticProps
generates HTML and JSON files, both of which can be cached by a CDN for performance.
From the doc, it doesn't elaborate on how exactly getStaticProps
with CDN should be served in production. I am wondering if it is referring only to the pure static blog-like web pages, which don't use fallback
nor regeneration
. I have a feeling that getServerSideProps
with CDN in front of server/lambda might be an easier and more performant cache architecture.
Question
Should NextJS getStaticProps
with fallback and regeneration be used to serve a user-made-content web app?
To have the answer of this question, I believe I will need to understand a few things first:
Things I don't know and I can't find any related documentation
- How exactly pages with
getStaticProps
, fallback, and regeneration should be served with CDN as the doc above mentioned? - Do the network requests have to always go through NextJs when using fallback? Are there examples of putting CDN of prerendered pages in front of server/lambda meanwhile supporting
fallback
®en
? My idea is to avoid server hits and save even more processing time & resources when there is a prerendered page. - Does
fallback
andregeneration
support saving the newly generated HTML and JSON in a remote store like S3, and make NextJS read from it? - If the answer is no from question above, when serverless, say Lambda, how does it reuse the newly generated files? Does it rely on non-cold Lambda container memory/state? When with servers, can I share the newly generated artifacts across servers?
I could have missed some of the docs. Any clues, links, or corrections will be appreciated.
Thanks in advance =]
Update
I have found more information as below
- Serverless NextJs curret architecture
- Serverless NextJs RFC on fallback
- NextJs RFC on Incremental Static Regeneration
For the remaining questions, I have raised them to NextJS at this post.