Setup guide

How to add llms.txt to TanStack Start

Add a server route at src/routes/llms[.]txt.ts. The [.] escapes the dot so the file resolves to /llms.txt. Keep the body in a typed module for easy editing.

3
Steps
2
Prereqs
1
Gotchas

Before you start

  • A TanStack Start project
  • An llms.txt body — drafted in src/lib/llms-txt.ts or generated via the OptimAIze tool
Step-by-step

Install in 3 steps

  1. 1

    Create the route file

    Add src/routes/llms[.]txt.ts with a GET handler returning new Response(content, { headers: { 'Content-Type': 'text/plain' } }).

  2. 2

    Source the body from a typed module

    Keep your llms.txt content in src/lib/llms-txt.ts so you can edit it like any other code.

  3. 3

    Verify

    Hit /llms.txt in dev. Confirm UTF-8 + text/plain in the response headers.

Troubleshooting

Route resolves to /llms but not /llms.txt

Check the bracketed dot — filename must be llms[.]txt.ts, not llms.txt.ts.

Build excludes the route

Confirm the file is under src/routes and not src/server or another excluded directory.

Common gotchas

  • Don't put it in /public if your build pipeline doesn't copy that folder to the worker — server routes are safer

Generate your llms.txt in 30 seconds

Use the free OptimAIze generator, then follow the steps above to deploy on TanStack Start.

Frequently asked questions

Does TanStack Start need both llms.txt and robots.txt?

Yes. robots.txt grants crawler permission; llms.txt curates which pages matter. Together they form the minimum AI-search setup on any TanStack Start site.

Will adding llms.txt slow down my site?

No. It's a tiny static text file fetched once and cached aggressively. Page-load impact is effectively zero.

How often should I update llms.txt?

Whenever your canonical content set changes — new docs section, new product line, new pricing page. A monthly review is a sensible cadence for most sites.

Can I see whether AI engines read my llms.txt?

Check your server logs for user agents like GPTBot, ClaudeBot, PerplexityBot, and Google-Extended hitting /llms.txt. Most sites see traffic within days of publishing.

Other platforms