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.
Before you start
- ✓A TanStack Start project
- ✓An llms.txt body — drafted in src/lib/llms-txt.ts or generated via the OptimAIze tool
Install in 3 steps
- 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
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
Verify
Hit /llms.txt in dev. Confirm UTF-8 + text/plain in the response headers.
Troubleshooting
Check the bracketed dot — filename must be llms[.]txt.ts, not llms.txt.ts.
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
Strategic LLM Directives on TanStack Start
Implementing an `llms.txt` file on your TanStack Start application is a strategic move for fine-tuning AI search visibility. Unlike traditional `robots.txt` which guides web crawlers, `llms.txt` specifically instructs large language models (LLMs) on how to interact with your content. For a dynamic framework like TanStack Start, this means explicitly defining which routes, data fetching patterns, or state-managed content should be emphasized or excluded from LLM training and RAG (Retrieval Augmented Generation) processes. This proactive approach ensures that your carefully structured data and unique user experiences, often built with TanStack's robust features, are interpreted correctly by generative AI, preventing misinterpretations or the indexing of sensitive or irrelevant information. It directly impacts how your application's unique value proposition is surfaced in AI-driven search.
Crafting Your llms.txt for Start's Architecture
When developing an `llms.txt` for a TanStack Start project, consider its client-side hydration and server-side rendering (SSR) capabilities. Directives should account for both pre-rendered static content and dynamically generated data. For instance, you might allow LLMs to crawl specific static pages rendered by Start's build process but disallow access to authenticated routes or dynamic API endpoints that generate user-specific content. Utilize `User-agent:` declarations to target specific LLMs (e.g., `User-agent: OptimAIze-Bot` for our scanner) and `Allow:` or `Disallow:` rules for paths. Due to Start's file-based routing, mapping these directives to your `src/routes` directory structure is intuitive, ensuring granular control over what LLMs can 'learn' from your application. Precision here improves both your AI visibility and data governance.
Maintaining Relevance and Accuracy with Updates
The digital landscape and AI capabilities evolve rapidly, making `llms.txt` maintenance crucial for TanStack Start applications. As you introduce new routes, update data schemas, or deploy new features (e.g., from TanStack Query or Router updates), your `llms.txt` should reflect these changes. Regularly review your directives to ensure they align with your current content strategy and AI visibility goals. A stale `llms.txt` can lead to outdated or irrelevant content being cited by LLMs, potentially impacting the accuracy of AI-driven search results and the perception of your brand. Integrate `llms.txt` reviews into your deployment pipeline for TanStack Start to ensure continuous optimization of your AI search presence. This vigilance translates directly into sustained AI discoverability and accurate content representation.
llms.txt Directives for TanStack Start Paths
| Directive Type | Example Path for Start | AI Search Visibility Impact |
|---|---|---|
| General Allow | Allow: /blog/* | Permits LLMs to access all blog posts for RAG and training, increasing visibility of thought leadership. |
| Specific Disallow | Disallow: /account/settings | Prevents LLMs from indexing user-specific or sensitive configuration pages, enhancing privacy. |
| OptimAIze-Bot Allow | User-agent: OptimAIze-Bot Allow: /products/* | Grants OptimAIze scanner specific access to product listings for tailored AI visibility reports. |
| Disallow Dynamic APIs | Disallow: /api/user-data* | Blocks LLMs from crawling backend API endpoints returning dynamic, often sensitive, user data. |
| Prefer Canonical | Canonical: /articles/main-topic | Guides LLMs to a preferred version of content, mitigating duplication issues across different Start routes. |
Essential llms.txt Checklist for TanStack Start
- Create `llms.txt` in the root of your `public` directory (or equivalent static asset folder) for TanStack Start.
- Identify all public-facing routes (`src/routes`) that should be discoverable by LLMs.
- List all sensitive or irrelevant routes (e.g., `/admin`, `/auth/*`, `/user-dashboard`) to be disallowed.
- Include a generic `User-agent: *` block for broad compliance, followed by specific LLM directives.
- Add a specific `User-agent: OptimAIze-Bot` block to optimize scanning by OptimAIze.
- Validate `llms.txt` syntax using a linter or an `llms.txt` checker tool before deployment.
Deploying & Verifying llms.txt on TanStack Start
- 1Generate File
Create the `llms.txt` file in the root of your project's `public` directory, ensuring it's accessible at `yourdomain.com/llms.txt`.
- 2Configure Build
Ensure your TanStack Start build process (e.g., Vite configuration) includes `llms.txt` in the final static output for deployment.
- 3Deploy & Verify
Deploy your TanStack Start application; then, visit `yourdomain.com/llms.txt` in a browser to confirm it's publicly accessible and correctly formatted.
- 4Monitor with OptimAIze
Use OptimAIze to scan your site, which will read your `llms.txt` and provide specific insights into your AI visibility based on your directives.
More questions answered
- Why do I need `llms.txt` if I already have `robots.txt` for my TanStack Start app?
- `llms.txt` is distinct from `robots.txt`. While `robots.txt` guides web crawlers for traditional search engines, `llms.txt` provides specific instructions for Large Language Models (LLMs). This allows finer control over how AI models interpret and use your TanStack Start content, enhancing precision and avoiding miscontextualization in AI-driven search results.
- How does TanStack Start's architecture affect my `llms.txt` directives?
- TanStack Start's blend of SSR, SSG, and client-side hydration means content can exist in different states. Your `llms.txt` needs to account for both static pre-rendered routes and dynamic content. Directives should target paths consistently, whether they are generated during build time or hydrated on the client, ensuring comprehensive coverage for AI models.
- Can I target specific LLMs with my `llms.txt` file?
- Yes, similar to `robots.txt`, you can use `User-agent:` directives in `llms.txt` to specify rules for particular LLM bots. For example, `User-agent: OptimAIze-Bot` allows you to set specific guidelines for our scanner, enabling tailored control over which parts of your TanStack Start application we assess for AI visibility.
- What happens if I don't implement or properly maintain an `llms.txt` file?
- Without a properly implemented `llms.txt`, LLMs might index and cite content from your TanStack Start application indiscriminately. This could lead to sensitive data exposure, misinterpretation of your content's context, or the inclusion of irrelevant information in AI-generated responses, negatively impacting your AI visibility and brand reputation.
Explore further
Connected guides to keep going — short reads, all internally linked.