Vite SSR BOOST

SSR for React Router apps in Data mode, without moving to Framework mode and without rewriting the app.
Quick start
Add to an existing app:
npm i @lomray/vite-ssr-boost
npx ssr-boost init --dry-run
npx ssr-boost init --apply
npm install
npx ssr-boost doctor
@lomray/vite-ssr-boost adds server rendering to your Vite project while keeping your route objects and components. Build SSR and SPA output from the same app, and choose a managed server (Express or node:http) or a Fetch handler for your own transport.
The migration guide walks through the five-file change:
| File | Change |
|---|
vite.config.ts | Add SsrBoost() to the plugins. |
src/index.html | Add the SSR outlet inside the root element. |
src/client.ts | Use the browser entry for hydration or SPA mounting. |
src/server.ts | Add the server entry and request-scoped setup. |
package.json | Use the ssr-boost dev, build and start commands. |
Start a new app with the minimal template (default):
npm create @lomray/ssr-app@latest my-app
Choose the full template by passing the flag after --:
npm create @lomray/ssr-app@latest my-app -- --template full
Starting a new app? Choose one of the template branches with the npm create command or clone the branch directly.
To defer loader work, return { title, slow: fetchUsers() } and render slow with Suspense and <Await>; see the streaming guide.
Who this is for
- Teams adding SSR to a Vite SPA with React Router route objects.
- Teams that need server rendering and SPA output from one application.
- Teams that want to control request hooks, response headers and deployment.
What you keep
- Your Vite configuration and plugins, with the SSR plugin added.
- Your React Router route objects.
- Your components, after removing browser globals from server execution.
- Your React version within the package's peer range: React and React DOM
>=18.2.0.
- Your hosting choice, provided it can run the selected SSR transport or serve SPA files.
Loader and action promises support <Await> and React 19 use() during hydration by default. Stream loader data shows the loader pattern and hydration: 'early' for shell interaction before slow boundaries finish.
What you add