---
title: Tanstack Start
description: Setup Fumadocs on Tanstack Start.
---

## Getting Started

Before continuing, make sure to configure:

- Tailwind CSS 4.
- Fumadocs MDX: follow the [Vite setup guide](/docs/mdx/vite) and create essential files like `lib/source.ts`.

### Installation

```npm
npm i fumadocs-core fumadocs-ui
```

### Styles

Add the following to your Tailwind CSS file:

```css title="styles/app.css"
@import 'tailwindcss';
/* [!code ++:2] */
@import 'fumadocs-ui/css/neutral.css';
@import 'fumadocs-ui/css/preset.css';
```

### Create Pages

Create the following files:

<include cwd meta='tab="components/mdx.tsx"'>
  ../../examples/tanstack-start-min/src/components/mdx.tsx
</include>
<include cwd meta='tab="lib/layout.shared.tsx"'>
  ../../examples/tanstack-start-min/src/lib/layout.shared.tsx
</include>
<include cwd meta='tab="routes/docs/$.tsx"'>
  ../../examples/tanstack-start-min/src/routes/docs/$.tsx
</include>
<include cwd meta='tab="routes/api/search.ts"'>
  ../../examples/tanstack-start-min/src/routes/api/search.ts
</include>

Wrap your entire app under Fumadocs providers:

```tsx title="__root.tsx"
import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router';
import * as React from 'react';
import { RootProvider } from 'fumadocs-ui/provider/tanstack';

export const Route = createRootRoute({
  component: RootComponent,
});

function RootComponent() {
  return (
    <RootDocument>
      <Outlet />
    </RootDocument>
  );
}

function RootDocument({ children }: { children: React.ReactNode }) {
  return (
    <html suppressHydrationWarning>
      <head>
        <HeadContent />
      </head>
      <body className="flex flex-col min-h-screen">
        {/* [!code ++] */}
        <RootProvider>{children}</RootProvider>
        <Scripts />
      </body>
    </html>
  );
}
```

### Done

You can start writing documents at `content/docs`:

```mdx title="content/docs/index.mdx"
---
title: Hello World
---

I love Fumadocs
```
