ssr

Implements non-streaming and streaming server-side rendering for TanStack Router applications.

Updated May 26, 2026
One-click install
npx skills add https://github.com/Albo-Club/albo-os --skill ssr-albo-club
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ssr
Source: https://github.com/Albo-Club/albo-os/tree/main/.agents/skills/tanstack-router-core/ssr
Command: npx skills add https://github.com/Albo-Club/albo-os --skill ssr-albo-club

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-router.

What problem does it solve? Setting up server-side rendering with TanStack Router requires coordinating server entries, client hydration, loader dehydration, and document head management, and mistakes cause hydration mismatches or runtime crashes. ## Core Features & Use Cases - SSR Setup Patterns: Configure non-streaming SSR with renderRouterToString or streaming SSR with renderRouterToStream via createRequestHandler and default handlers. - Document Head Management: Control title, meta, links, and body scripts per route with the head option, HeadContent, Scripts, and ScriptOnce components. - Use Case: Integrate TanStack Router SSR into an existing Express server by converting Express requests to Web API Requests and piping the rendered response stream back. ## Quick Start Set up streaming SSR for my TanStack Router app with a shared router factory, server entry, and client hydration entry.

Frequently Asked Questions about ssr

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

FAQPage Schema
How do I set up SSR with TanStack Router?

Create a shared createRouter factory, then build a server entry using createRequestHandler with defaultRenderHandler or defaultStreamHandler, and a client entry that calls hydrateRoot with RouterClient. Loader data is automatically dehydrated on the server and hydrated on the client.

What is the difference between streaming and non-streaming SSR in TanStack Router?

Non-streaming SSR renders the full page on the server and sends one HTML response via renderRouterToString. Streaming SSR uses renderRouterToStream to send the critical first paint immediately and stream remaining content, including deferred loader data, incrementally.

Do TanStack Router loaders run on the server with SSR?

Yes, with SSR enabled loaders run on both client and server; they are not server-only like Remix or Next.js loaders. Browser-only APIs such as window or localStorage must be guarded with an environment check to avoid server crashes.

Can I use TanStack Router SSR with Express?

Yes, createRequestHandler accepts a Web API Request and returns a Web API Response, so Express handlers must convert req into a Request and pipe the response body back with node stream pipeline. An example conversion is included in the documentation.

Why does my SSR app have hydration mismatches?

Common causes include using hash fragments for conditional rendering, since hashes never reach the server, and browser-only APIs in loaders. Use search params for server-visible state and suppressHydrationWarning when pre-hydration scripts modify the DOM.

Should I use manual SSR or TanStack Start?

TanStack Start is the recommended way to do SSR in production because the manual SSR APIs are experimental and may change. Use manual SSR setup only when integrating TanStack Router with an existing server.