Laravel + Inertia: unable to implement server side rendering with default scaffolding for Laravel Breeze

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

Laravel + Inertia: Solving the Server-Side Rendering Mystery with Breeze SSR

As a senior developer working within the Laravel ecosystem, implementing modern full-stack applications often involves integrating powerful tools like Inertia.js for bridging the gap between traditional server-side rendering (SSR) and rich client-side interactivity using Vue or React. When setting up a fresh project using Laravel Breeze scaffolding with the --ssr flag, developers frequently encounter subtle configuration hurdles that prevent the expected SSR content from appearing in the browser.

The issue you've encountered—where the build succeeds but the rendered HTML lacks server-side content—is a common point of confusion. It usually indicates a mismatch between how Vite handles asset bundling and how Inertia/Vue expects to receive the initial payload on the server.

Let’s break down why this happens and how to ensure your Laravel + Inertia setup delivers seamless Server-Side Rendering.

Diagnosing the SSR Disconnect

When you run php artisan breeze:install vue --ssr, Laravel Breeze correctly sets up the necessary structure, but the actual rendering mechanism relies heavily on the configuration of Vite and the specific Inertia server setup. The discrepancy often stems from how the build process compiles the server-side entry points versus the client-side assets.

The core of solving this lies in ensuring that the ssr plugin within vite.config.js correctly delegates responsibilities to @inertiajs/server. If the configuration isn't precisely aligned, Vite might optimize away or misroute the necessary server-rendered components.

Analyzing the Critical Configuration Files

Your provided configuration snippets are highly indicative of the problem area:

  1. vite.config.js:

    // vite.config.js
    import { defineConfig } from 'vite';
    import laravel from 'laravel-vite-plugin';
    import vue from '@vitejs/plugin-vue';
    
    export default defineConfig({
        plugins: [
            laravel({
                input: 'resources/js/app.js',
                ssr: 'resources/js/ssr.js', // Crucial for SSR entry point
                refresh: true,
            }),
            // ... vue plugin configuration
        ],
        ssr: {
            noExternal: ['@inertiajs/server'], // Ensures Inertia server component is handled correctly
        },
    });
    

    The setting ssr: 'resources/js/ssr.js' explicitly tells Vite where to find the Server-Side Rendering entry point, which must be correctly integrated with @inertiajs/server.

  2. app.js (Client Entry Point):
    This file handles the client-side mounting logic using createInertiaApp. It correctly resolves components via resolvePageComponent, which is essential for Inertia to manage state across the server and client.

  3. ssr.js (Server Entry Point):

    // ssr.js
    import { createSSRApp, h } from 'vue';
    import { renderToString } from '@vue/server-renderer';
    import { createInertiaApp } from '@inertiajs/inertia-vue3';
    import createServer from '@inertiajs/server'; // The core Inertia server module
    // ... other imports
    
    createServer((page) => {
        createInertiaApp({
            page,
            render: renderToString, // Tells Inertia to use Vue's SSR rendering function
            // ... setup
        })
    });
    

    This script is where the magic happens. By using createServer from @inertiajs/server and instructing it to use renderToString, you are explicitly telling the server environment how to execute the Vue component rendering process into a string, which Inertia then serializes for the response.

The Build Process: Ensuring Correct Execution

The final step is often overlooked: the build command itself must execute both client and server compilation correctly. The recommended sequence remains:

vite build && vite build --ssr

This ensures that all necessary assets are compiled, and critically, that the specific SSR entry point (ssr.js) is executed during the build phase to generate the necessary server artifacts alongside the standard client bundle.

Conclusion: Mastering the Inertia/SSR Pipeline

Implementing Server-Side Rendering with Laravel Breeze and Inertia is not just about installing a flag; it's about correctly configuring the entire pipeline—from Vite asset management down to the Inertia server module. The lack of SSR content usually points to an incomplete handshake between the frontend build process and the backend server execution. By meticulously aligning your vite.config.js with the requirements of @inertiajs/server, you can successfully bridge the gap, ensuring that Laravel applications deliver fast, fully rendered pages, as promoted by modern Laravel development practices found at laravelcompany.com. Mastering these configuration details is key to unlocking the full potential of full-stack frameworks in Laravel.