router-core/ssr

Implement unified server-side and client-side rendering for TanStack Router applications.

4|1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill router-core-ssr-lespaceman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/ssr
Source: https://github.com/lespaceman/athena-workflow-marketplace/tree/main/plugins/tanstack-start/skills/upstream/%40tanstack/router-core/skills/router-core/ssr
Command: npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill router-core-ssr-lespaceman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Non-streaming and streaming SSR, RouterClient/RouterServer integration, renderRouterToString/renderRouterToStream, createRequestHandler, defaultRenderHandler/defaultStreamHandler, HeadContent/Scripts components, head route option (meta/links/styles/scripts), ScriptOnce, automatic loader dehydration/hydration, memory history on server, data serialization, and document head management.

Core Features & Use Cases

  • Provides unified SSR support for TanStack Router across server and client environments.
  • Supports both non-streaming and streaming SSR with proper hydration and progressive rendering.
  • Manages document head, scripts, and pre-render hooks via ScriptOnce and HeadContent.

Quick Start

Set up SSR by wiring a shared router and using defaultRenderHandler or defaultStreamHandler to render on both server and client.

Frequently Asked Questions about router-core/ssr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up server-side rendering with TanStack Router?

Server-side rendering with TanStack Router is set up by wiring a shared router and using defaultRenderHandler or defaultStreamHandler to render on both server and client environments. It provides APIs like createRequestHandler to manage requests.

Does TanStack Router support streaming SSR?

Yes, TanStack Router supports streaming SSR through the renderRouterToStream API. It allows progressive rendering and proper hydration while managing loader dehydration and data serialization across environments.

How does loader dehydration and hydration work in TanStack Router SSR?

Loader dehydration and hydration in TanStack Router SSR automatically serializes server-loaded data for the client. This ensures the client router hydrates with the exact same data state without duplicate network fetches.

Can I manage document head tags and scripts during server-side rendering?

Yes, document head management during server-side rendering is handled via the head route option for meta, links, styles, and scripts. The HeadContent and ScriptOnce components inject these elements across server and client.

What is the difference between renderRouterToString and renderRouterToStream?

renderRouterToString provides non-streaming server-side rendering by returning a complete HTML string, whereas renderRouterToStream enables streaming SSR for progressive rendering and faster initial document transmission.

How do I use memory history for server-side rendering in TanStack Router?

Memory history is used on the server to manage TanStack Router routing state without a browser DOM. It integrates with createRequestHandler to process incoming URLs and render the correct route state.