Rendering

There are several approaches and techniques for rendering web pages, with each having unique benefits and caveats.

Main Approaches

There are three main approaches.

  1. Server-Side Rendering (SSR): Renders HTML on server per request.
  2. Static Site Generation (SSG): Builds all pages at compile time.
  3. Client-Side Rendering (CSR): Browser handles all rendering via JS.

Each approach is good at specific use cases:

ApproachPerfect ForAvoid For
SSRDynamic dashboards, Social networksStatic content sites
SSGBlogs, DocumentationUser-specific content
CSRWeb apps, Admin panelsContent marketing

Hybrid Solutions

As there are trade-offs with each main approach, a number of hybrid solutions have been explored.

  1. Islands Architecture: Static HTML with interactive "islands"

    <static-header>
      <interactive-search> 
    </static-header>
    <static-content>
    
  2. Incremental Static Regeneration: Static + background revalidation

These are optimal at more use cases:

ApproachPerfect ForAvoid For
IslandsContent + InteractivityComplex applications
ISRE-commerce, Dynamic contentReal-time data

Comparison

Core Metrics

ApproachInitial LoadTime to InteractiveSEOServer LoadBuild TimeDevelopment UX
SSRFastSlowExcellentHighNoneMedium
SSGFastestMediumExcellentNoneHighEasy
CSRSlowFastestPoorLowLowEasy
IslandsFastMediumExcellentLowMediumComplex
ISRFastMediumExcellentMediumMediumMedium

Data Handling

ApproachReal-timeUser-specificCache-friendlyUpdate Speed
SSRExcellentExcellentPoorInstant
SSGPoorPoorExcellentBuild only
CSRExcellentExcellentMediumInstant
IslandsGoodGoodExcellentMixed
ISRGoodMediumExcellentBackground

Resource Usage

ApproachMemoryCPUBandwidthStorage
SSRHighHighLowLow
SSGLowLowLowestHigh
CSRLowMediumHighLow
IslandsMediumMediumMediumMedium
ISRMediumMediumLowHigh

Developer Experience

ApproachLearning CurveDebuggingTestingDeployment
SSRMediumHardMediumComplex
SSGEasyEasyEasySimple
CSREasyMediumEasySimple
IslandsHardHardHardMedium
ISRMediumMediumMediumComplex

Framework Support

ApproachNext.jsRemixAstroSvelteKitNuxt
SSR⚠️
SSG
CSR
Islands
ISR⚠️

✅ Full support

⚠️ Partial support

❌ No native support