Server-Side Rendering (SSR)

This page is rendered on the server for each request with prerender: false

Server Time

2026-01-15T19:31:48.708Z

Refresh the page to see the time update

How It Works

1. Request comes to the server

2. Astro renders the page with fresh data

3. HTML is sent to the client

4. Great for dynamic, personalized content

5. Requires a server runtime (Node, Deno, etc.)

Code Example

---
// pages/ssr.astro
export const prerender = false; // Enable SSR

const serverTime = new Date().toISOString();
const userData = await fetchUserData(Astro.cookies);
---

<Layout>
  <h1>SSR Page</h1>
  <p>Server time: {serverTime}</p>
  <p>Welcome, {userData.name}!</p>
</Layout>