The data is fetched at build time, and the same HTML file is served to every user.
- Fetches data at build time.
- Generates static HTML pages that can be cached by CDNs.
- No real-time updates (unless revalidated with incremental static regeneration).
- Faster response times since the HTML is pre-generated.
- Ideal for pages that do not require real-time data.
- SSR is used to fetch data on each request.
- Whenever a user requests a page, the data is fetched in real-time
- The page is rendered on the server before being sent to the user.
- Fetches data at request time, for each request.
- Always serves fresh, up-to-date data.
- Slower response times compared to SSG, as the page is rendered on every request.
- Ideal for pages that require real-time or user-specific data.