⚠️
The vite-plugin-ssr project has been renamed Vike.
  • If you are using vite-plugin-ssr, migrate to Vike.
  • For new projects, use Vike instead of vite-plugin-ssr.
Vike itself (without extensions) is like vite-plugin-ssr: unopinionated and fully agnostic.

Data Store

With vite-plugin-ssr we keep control over our app architecture; we can integrate any data store tool we want simply by following its SSR docs.

Reading Recommendation.

On a high-level, an SSR integration usually works like this:
  1. We set the initial state of the store on the server-side. (We do it on the server-side so that the initial state is rendered to HTML.)
  2. We make the initial state available as pageContext.initialStoreState.
  3. We make pageContext.initialStoreState available on the browser-side by adding 'initialStoreState' to passToClient.
  4. We initialize the store on the browser-side using pageContext.initialStoreState.

Examples