Skip to main content
InterviewHubPRO
Section Overview
Q38

Question 38 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

76%
Astro Islands & SSR (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Astro Hybrid Rendering: `output: 'hybrid'` and `prerender = true/false`.

senior LevelCode ExampleSSR & HydrationSystem DesignAstro

In Simple Words: In Astro, you don't have to choose between a 100% static site or a 100% dynamic server:

  • output: 'static': Pure Static Site Generation (SSG).
  • output: 'hybrid': Everything is pre-rendered static by default. Individual dynamic routes opt out with export const prerender = false;.
  • output: 'server': Everything is Server-Side Rendered (SSR) by default. Static pages opt into pre-rendering with export const prerender = true;.
astro
---
// src/routes/dashboard.astro (Inside hybrid mode)
// Opts this specific page into real-time server rendering
export const prerender = false;

const user = Astro.locals.user;
if (!user) return Astro.redirect('/login');
---
<h1>Welcome back, {user.name}</h1>