Skip to components

TanStack Start and Revo UI

TanStack Start renders the route on the server and hydrates it in the browser. Keep the normal SSR route and render the Revo UI React adapter directly.

Run the example

Open the complete starter. Use Node.js 24.15 or newer and pnpm 11. The lockfile pins the verified dependency versions.

git clone https://github.com/revolist/revo-ui.git
cd revo-ui/examples/ssr/tanstack-start
pnpm install --frozen-lockfile
pnpm build
pnpm start

Open http://localhost:3000. The heading is present in the initial server HTML. Click Save 0 and it becomes Save 1. Reloading resets local state. For development, use pnpm dev.

Files to read

File Responsibility
vite.config.ts Enables Start, a Node server build through Nitro, and React.
src/router.tsx Creates a fresh router.
src/routes/__root.tsx Renders the document and links the extracted UI stylesheet.
src/routes/index.tsx Loads the title and renders the page with its button count.

Use the button directly in the route

createServerFn keeps the report function on the server. The route loader calls it for the initial request and framework navigation. The same route component owns the button's local count:

import { useState } from 'react';
import { createFileRoute } from '@tanstack/react-router';
import { createServerFn } from '@tanstack/react-start';
import { SvgButton } from '@revolist/ui/react/unstyled';

const getReport = createServerFn().handler(() => ({
  title: 'TanStack Start report',
}));

export const Route = createFileRoute('/')({
  loader: () => getReport(),
  component: Home,
});

function Home() {
  const [count, setCount] = useState(0);
  const report = Route.useLoaderData();
  return (
    <main>
      <h1>{report.title}</h1>
      <p>This title comes from a server function.</p>
      <SvgButton
        label={`Save ${count}`}
        visibleLabel={`Save ${count}`}
        onClick={() => setCount((value) => value + 1)}
      />
    </main>
  );
}

The example returns one fixed title. Replace the server function body with your server data access when needed.

Load CSS in the root route

The ?url import gives the root route an emitted CSS URL. HeadContent writes its stylesheet link into the server response:

import {
  createRootRoute,
  HeadContent,
  Outlet,
  Scripts,
} from '@tanstack/react-router';
import css from '@revolist/ui/styles/base.css?url';

export const Route = createRootRoute({
  head: () => ({ links: [{ rel: 'stylesheet', href: css }] }),
  component: Root,
});

function Root() {
  return (
    <html lang="en">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <HeadContent />
      </head>
      <body>
        <Outlet />
        <Scripts />
      </body>
    </html>
  );
}

Start generates src/routeTree.gen.ts; do not edit that file. The example uses Nitro's Node server output. Its start command runs .output/server/index.mjs; a different hosting platform needs its own deployment adapter. The button changes local state and does not save data remotely.

Styles and rendering

Use @revolist/ui/react/unstyled with @revolist/ui/styles/base.css loaded once through the framework. This supplies the button's styles without runtime stylesheet insertion. Add a component's style family only when using that component.

The adapter renders a host on the server and mounts its control in the browser. Important headings, text and any no-JavaScript experience remain the host framework's responsibility. A stylesheet does not turn that host into full server-rendered control HTML. See the SSR overview.

Check your result

Run the production commands above, then check the response, button click, reload, and browser console. Keep server and client dependency versions aligned. Test your own deployment after changing adapters, CSP or hosting settings.

TanStack Start build from scratch and hosting.