Getting started
Installation
bash
npm i lovable-ssrPeer dependencies: react (^18), react-dom (^18), react-router-dom (^6).
Overview
- Define routes and call
registerRoutes(routes)so the framework can match URLs and rungetDatawhen needed. - Wrap your app with
BrowserRouteDataProviderand renderAppRoutes(insideBrowserRouter). - (Optional) SSR — add an entry module that calls the framework’s
renderwith your wrappers, and a small server that usescreateServerfromlovable-ssr/server.
The framework provides:
- A route registry (singleton): you register once;
RouterServiceandAppRoutesread from it. - Route data context: initial data from SSR (
window.__PRELOADED_DATA__) and data fetched on client when you navigate to a route that hasgetData. - SSR render and Express + Vite server (optional).