Michele Riva
Senior Software Architect @NearForm
Google Developer Expert
Microsoft MVP
MicheleRivaCode
Build scalable, high performances and modern web applications using Next.js, the React framework for production
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
Client-side rendering (CSR)
MicheleRivaCode
Client-side rendering (CSR)
MicheleRivaCode
MicheleRivaCode
Server-side Rendering (SSR)
MicheleRivaCode
MicheleRivaCode
Static-site generation (SSG)
MicheleRivaCode
*can be fixed via incremental static regeneration (ISR)
MicheleRivaCode
MicheleRivaCode
Client-side rendering
MicheleRivaCode
Server-side rendering
MicheleRivaCode
Static site generation
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
Let's say we have to handle 100 SSR requests per second (259,200,000 requests per month).
The average execution time is 300ms.
We can use the cheapest RAM option (128MB).
We require around 100kb of bandwidth per execution.
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
SSR
SSR + CACHE
SSG + ISR
SSG + CSR
MicheleRivaCode
Content is dynamic and depends on the user?
Generate a static page at build time and render the dynamic data on the client-side.
MicheleRivaCode
Content is static and SEO is important?
Generate a static page at build time and adopt ISR when needed.
MicheleRivaCode
Content is static, but the pages gets created dynamically
Server-side render your pages and put your webapp behind a cache.
MicheleRivaCode
MicheleRivaCode
https://rwnjs.com/order/amazon
https://rwnjs.com/order/packt
Adapted from
Real-World Next.js
MicheleRivaCode
MicheleRivaCode
@MicheleRiva
@MicheleRivaCode
/in/MicheleRiva95
www.micheleriva.dev