Skip to content
Personal Github

📷 SSR - CSR - SSG differencies

-10 minutes of reading.

Server-Side Rendering (SSR), Client-Side Rendering (CSR), Static Site Generation (SSG) and Incremental Static Regeneration (ISR) are all techniques used to render web pages. The main difference between these techniques is when and where the page is rendered.

SSR (Server-Side Rendering)

In SSR, the page is rendered on the server and the rendered HTML is sent to the client. This means that the page is complete when it reaches the client and can be displayed immediately. However, SSR can be more expensive on the server, as it requires more processing power.

Image of SSR rendering

CSR (Client-Side Rendering)

In CSR, the page is rendered on the client's browser. This means that the client has to download the HTML and then execute JavaScript to render the page. This can take longer than SSR, but it can be more efficient on the server.

Image of CSR rendering

SSG (Static Site Generation)

In SSG, the entire page is pre-rendered on the server. This means that the page is completely static and can be served to the client without any JavaScript. This can be very fast, as the server does not have to do any additional processing. However, SSG can be difficult to maintain, as it requires the page to be regenerated whenever the data changes.

Image of SSG rendering

ISR (Incremental Static Regeneration)

ISR is a hybrid of SSR and SSG. In ISR, the page is pre-rendered on the server, but it is also updated asynchronously. This means that the page can be served to the client quickly, and it can also be updated as needed without having to re-generate the entire page.

Image of ISR rendering

Which is the right choice?

The right choice for your project will depend on your specific needs. If you need the fastest page load times, SSG is a good option. However, if you need to be able to update the page frequently, CSR or ISR may be a better choice.

Table summarizing the key differences between SSR, CSR, SSG and ISR:

TechniqueWhen is the page rendered?Where is the page rendered?BenefitsDrawbacks
SSROn the serverOn the serverFast initial page load timesCan be expensive on the server
CSROn the clientOn the clientEfficient on the serverSlower initial page load times
SSGOn the serverOn the serverVery fast page load timesCan be difficult to maintain
ISROn the server and on the clientOn the serverFast initial page load timesCan be more complex than SSG or CSR