SSR (Optional)
Nestipy Web supports optional server‑side rendering. Start with CSR, then enable SSR if needed.
Build
bash
nestipy run web:build --vite --ssrServe
bash
nestipy start --web --ssrRuntimes
SSR runs on either:
jsrun(default if available)node(fallback when jsrun is unavailable)
Force a runtime:
bash
NESTIPY_WEB_SSR_RUNTIME=node nestipy start --web --ssrOptional env flags:
NESTIPY_WEB_SSR=1NESTIPY_WEB_SSR_RUNTIME=jsrun|node|autoNESTIPY_WEB_SSR_ENTRY=web/dist/ssr/entry-server.jsNESTIPY_WEB_SSR_MANIFEST=web/dist/.vite/manifest.jsonNESTIPY_WEB_SSR_POLYFILLS=/path/to/polyfills.jsNESTIPY_WEB_SSR_CACHE=100NESTIPY_WEB_SSR_CACHE_TTL=30NESTIPY_WEB_SSR_STREAM=1NESTIPY_WEB_SSR_ROUTES=/,/pricingNESTIPY_WEB_SSR_EXCLUDE=/admin
Notes:
- SSR is optional and still evolving.
- If SSR fails, the CSR bundle will still be served.
jsrun (Python-only SSR)
The jsrun runtime is designed for pre-render SSR only:
- No streaming SSR
- No Suspense server features
- No React Server Components
Keep the SSR entry clean and render with renderToString, for example:
ts
import ReactDOMServer from "react-dom/server";
export function render(url: string) {
return ReactDOMServer.renderToString(<App />);
}Nestipy loads a minimal polyfill bundle before executing the SSR entry when NESTIPY_WEB_SSR_RUNTIME=jsrun. You can override it with:
bash
export NESTIPY_WEB_SSR_POLYFILLS=/path/to/polyfills.js