# Fumadocs (Framework Mode, TanStack Start): Custom Search
URL: /docs/tanstack-start/search/custom
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/(framework)/[framework]/search/custom.mdx

For other search solutions.

## Overview [#overview]

You can integrate any search engine with Fumadocs.

### Search Indexes [#search-indexes]

Fumadocs MDX exposes the search indexes of your pages at runtime.

To export them statically, add a pre-rendered `static.json` route, and process its records with a script after each build:

```ts tab="src/routes/static[.]json.ts"
import { createFileRoute } from '@tanstack/react-router';
import { source } from '@/lib/source';

async function getDocuments() {
  const documents = [];
  for (const page of source.getPages()) {
    documents.push({
      structured: await page.data.structuredData(),
      url: page.url,
      title: page.data.title,
      description: page.data.description,
    });
  }
  return documents;
}

export const Route = createFileRoute('/static.json')({
  server: {
    handlers: {
      GET: async () => Response.json(await getDocuments()),
    },
  },
});

```

```ts tab="vite.config.ts"
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
import { nitro } from 'nitro/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    tanstackStart({
      prerender: {
        enabled: true,
      },
      pages: [ // [!code ++:3]
        { path: '/static.json' }
      ],
    }),
    nitro({
      preset: 'vercel',
    }),
  ],
});

```

```ts tab="scripts/sync-content.ts"
import * as fs from 'node:fs/promises';
import type { StructuredData } from 'fumadocs-core/mdx-plugins';

interface DocumentRecord {
  title: string;
  description?: string;
  url: string;
  structured: StructuredData;
}

const records = JSON.parse(await fs.readFile('.vercel/output/static/static.json', 'utf-8')) as DocumentRecord[];

// sync the records to your search engine

console.log(`search updated: ${records.length} records`);

```

```json tab="package.json"
{
  "scripts": {
    "build": "vite build && node --env-file-if-exists=.env.local scripts/sync-content.ts"
  }
}
```

The `structured` field holds the headings and paragraphs of each page. Use it to generate accurate search indexes.