router-core-ssr

Implements streaming and non-streaming SSR for TanStack Router applications.

Updated Dec 21, 2025
One-click install
npx skills add https://github.com/Angael/veles --skill router-core-ssr-angael
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core-ssr
Source: https://github.com/Angael/veles/tree/main/.agents/skills/router-core-ssr
Command: npx skills add https://github.com/Angael/veles --skill router-core-ssr-angael

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 and client entries, request handlers, 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 using createRequestHandler and RouterServer/RouterClient. - Document Head Management: Define meta, links, styles, and 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 router-core-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 router factory, then build a server entry using createRequestHandler with defaultRenderHandler for non-streaming or defaultStreamHandler for streaming. On the client, hydrate with hydrateRoot and the RouterClient component.

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 before hydration. Streaming SSR sends the critical first paint immediately and streams remaining content incrementally, including deferred loader data.

Do TanStack Router loaders run on the server with SSR?

Yes, with SSR enabled loaders run on both client and server, unlike Remix or Next.js server-only loaders. Browser-only APIs like window or localStorage must be guarded with environment checks to avoid server crashes.

Can I use TanStack Router SSR with an Express server?

Yes, convert the Express request into a Web API Request with the correct URL and headers, pass it to createRequestHandler, then pipe the returned Response body stream back to the Express response.

Why does my SSR app have hydration mismatch errors?

Hydration mismatches occur when server and client render different output, such as using hash fragments or browser-only state during render. Use search params for server-visible state and suppressHydrationWarning for DOM-modifying scripts.

When should I use TanStack Start instead of manual SSR setup?

TanStack Start is the recommended approach for production SSR since the manual SSR APIs are experimental and may change. Use manual setup only when integrating SSR into an existing server you control.