# Inertia SSR

> Set up Inertia SSR for Laravel: install the SSR package, configure `INERTIA_SSR_ENABLED`, run `php artisan inertia:start-ssr`. Full server-side render in 5 minutes.

## Inertia SSR

Server-side rendering (SSR) improves the initial load time and SEO of your Inertia.js applications by rendering pages on the server before sending them to the browser.

### Prerequisites

<strong>Important:</strong> You must select a Node.js version in your application settings before adding the Inertia SSR service. SSR requires Node.js to render your Vue, React, or Svelte components on the server.

To configure Node.js:
<ol>
<li>Navigate to your application's <strong>Settings</strong> tab</li>
<li>Find the <strong>Node.js version</strong> section</li>
<li>Select a Node.js version (20, 22, or 24)</li>
<li>Save your settings and deploy your application</li>
</ol>

### Adding Inertia SSR

<ol>
<li>Go to your application's <strong>Services</strong> section</li>
<li>Click <strong>Add service</strong></li>
<li>Select <strong>Custom service</strong></li>
<li>Select the <strong>Rendering</strong> category</li>
<li>Choose <strong>Inertia SSR</strong></li>
<li>Optionally customize the SSR command</li>
<li>Click <strong>Create service</strong></li>
<li>Deploy your application</li>
</ol>

### How it works

The Inertia SSR service runs as a separate process alongside your main application. When a request comes in:

<ol>
<li>Your Laravel application receives the request</li>
<li>Instead of sending an empty HTML shell, Laravel calls the SSR server</li>
<li>The SSR server renders your frontend component to HTML</li>
<li>The fully rendered HTML is sent to the browser</li>
<li>The browser hydrates the page, making it interactive</li>
</ol>

### Environment variables

When you add the Inertia SSR service, the following environment variables are automatically configured:

<ul>
<li><code>INERTIA_SSR_ENABLED</code> - Set to <code>true</code> to enable SSR</li>
<li><code>INERTIA_SSR_URL</code> - The URL where the SSR server is running (<code>http://127.0.0.1:13714</code>)</li>
</ul>

These variables tell your Laravel application to use server-side rendering.

### Custom SSR command

By default, the service runs:

<pre><code>php artisan inertia:start-ssr</code></pre>

You can customize this when adding the service if your application uses a different command.

## Frequently asked questions

### What is the command to start the Inertia SSR server?

Run `php artisan inertia:start-ssr`. This starts a long-running Node.js process that renders your Vue or React components server-side before hydrating in the browser.

### What does the INERTIA_SSR_ENABLED environment variable do?

Setting `INERTIA_SSR_ENABLED=true` tells Inertia to render initial page loads on the server before sending HTML to the browser. Without it, Inertia falls back to client-side rendering only.

### What port does the Inertia SSR server listen on?

By default, Inertia SSR listens on port 13714. The Laravel app talks to it on this port to request server-rendered HTML. Configure it via `config/inertia.php` if needed.

### When should I enable SSR for an Inertia.js application?

Enable SSR when you need search engine indexing of dynamic content, faster perceived first-paint, or social-media link previews. Skip it for purely authenticated dashboards where neither SEO nor first-paint matters.
