Server-Side Rendering
View as MarkdownRoutes with config.mode set to "app" render on the server. Use them when
middleware, authentication, request data, or mutations must run at request
time.
Request lifecycle
For a matched app route, Neutron:
- Runs the configured middleware chain.
- Runs matching layout and page loaders in parallel.
- Renders their component tree into the document shell.
- Streams the response when the selected renderer supports streaming.
- Hydrates the document and starts the client router in the browser.
The initial response contains rendered HTML; it is not an empty client-side application shell.
Enable app mode
export const config = { mode: "app" };
The mode is declared per route, so static documentation or marketing pages can live beside authenticated application routes in the same project.
Cache a rendered response
cache.maxAge enables Neutron's route response cache:
export const config = {
mode: "app",
cache: { maxAge: 60 },
};
Use request-specific caching rules carefully for personalized responses. Route headers can also control downstream browser or CDN caching:
export function headers() {
return { "Cache-Control": "public, max-age=60, s-maxage=3600" };
}
See App Routes for loaders, actions, and the client entry.