SSR
Server-side rendering is the default Vext page path. The route handler owns the URL and prepares the data; the frontend page owns the React view.
Server Chain
The renderer uses:
- page component from
src/frontend/pages/** - matching
layout.tsxchain src/frontend/pages/error/**when rendering an error page- locale messages from
src/frontend/locales/** - manifest assets from the current frontend build
Example
What Can Run on the Server
Route handlers can use:
app.services- database clients owned by services
- request context and auth state
- response cache settings
- server-only environment variables
Page components must not import those server-only modules. They receive JSON-safe data.
HTML Document
src/frontend/pages/_document.html is the outer document template. It owns {vext.head}, {vext.styles}, {vext.root}, {vext.data}, and {vext.entry}. React layouts own the app shell inside the root.
Status and Headers
Use render options for HTML status and head data:
For JSON/API errors, keep using the existing API error response path. HTML rendering should not intercept API semantics.