Plaintext Engineering
0%

🖥️ What is Server‑Side Rendering (SSR)?

Aug 23, 2025 • 3 min read

Server‑Side Rendering (SSR) is a foundational web technique that affects how quickly users see content and how well search engines can index your pages. This guide explains what SSR is, how it works, its benefits, and when you should use it.

What is Server‑Side Rendering?

With SSR, the server generates the full HTML for a page and sends it to the browser. Unlike Client‑Side Rendering (CSR), where the browser downloads JavaScript and builds the page after load, SSR delivers a fully rendered page that can be displayed immediately.

How SSR Works (Step‑by‑Step)

  1. A user requests a URL.
  2. The server fetches any required data.
  3. The server executes code to build the complete HTML page.
  4. The rendered HTML is sent to the browser.
  5. The browser shows meaningful content immediately.
  6. JavaScript then loads in the background and “hydrates” the page to enable interactivity where needed.

In contrast, CSR typically waits for JavaScript bundles to download before rendering, delaying first meaningful paint.

Benefits of SSR

Common Use Cases

Frameworks with SSR Support

These tools pair SSR’s fast first render with client‑side hydration for rich interactivity.

Simple SSR Example (Next.js)

// pages/index.js
export async function getServerSideProps() {
  // Fetch data on the server before rendering
  const res = await fetch('https://api.example.com/posts');
  const posts = await res.json();
  return { props: { posts } };
}

export default function Home({ posts }) {
  return (
    <div>
      <h1>Blog Posts</h1>
      <ul>
        {posts.map((post) => (
          <li key={post.id}>{post.title}</li>
        ))}
      </ul>
    </div>
  );
}

getServerSideProps runs on the server at request time, so the HTML sent to the client already contains the data. This improves SEO and time‑to‑content.

When to Use SSR

Summary

Server‑Side Rendering (SSR) improves perceived performance and SEO by sending fully rendered HTML from the server, reducing the work browsers must do on first load. Modern frameworks make SSR approachable while preserving client‑side interactivity through hydration.

Sources

Related articles