<!-- Generated from llms-txt-remix/index.html. The canonical document is the HTML page. -->

- [ Home ](/) 
/
- [ How to create ](/how-to-create/) 
/
- Remix guide            
# `llms.txt` for Remix

Two approaches for Remix and React Router: a zero-config static file in public/, or a resource route that returns a plain-text Response, optionally generated from your content.

Last updated: October 29, 2026

On this page

- [ Remix v2, React Router and Remix 3 ](#versions)
- [ Option 1: static file in public/ ](#static)
- [ Option 2: resource route ](#resource-route)
- [ Existing Remix v2 apps ](#remix-v2)
- [ Verify ](#verify)             
## Remix v2, React Router and Remix 3

The React Router docs describe React Router v7 as the next major version of Remix after v2, so
apps built on Remix v2 continue as React Router framework-mode apps. The current major is React
Router 8 (`react-router` 8.0.0 was published on 2026-06-17; 8.5.1 is the latest at the
time of writing). Separately, the `remix` npm package now publishes Remix 3 (3.0.0 on 2026-10-01),
a different framework with its own APIs that this guide does not cover.

The examples below target **React Router framework mode**. A short section covers
[existing Remix v2 apps](#remix-v2).

Note

Which approach to use?

Use the  static file  if your  llms.txt  rarely changes and you don't
need to generate it from content. Use a  resource route  
for dynamic generation, especially if your docs are stored in a database or generated from MDX files.

## Option 1: static file in public/

React Router framework mode builds with Vite. Vite copies files from the `public/`
directory to the root of the build output unchanged, so `public/llms.txt` is served at
`/llms.txt` wherever that output is served as static assets. No routing configuration is
needed.
public/llms.txt, directory structure    Copy     

```
# Static file approach (React Router framework mode, Vite-based)
#
# Place your file at: public/llms.txt
# Vite copies public/ to the root of the build output as-is.
#
# Project structure:
# your-app/
# ├── public/
# │   └── llms.txt   ← add this
# ├── app/
# └── vite.config.ts

```

Use one approach per path: do not ship both `public/llms.txt` and a resource route for
`/llms.txt`.

## Option 2: resource route

In React Router, a route becomes a resource route when its module exports a `loader`
(or `action`) and no default component. Declare the route in `app/routes.ts`, then export a `loader` that returns a `Response` with the correct `Content-Type`. Loader argument types come from the generated `./+types/ ` module.
app/routes.ts    Copy     

```
// app/routes.ts
import { type RouteConfig, route } from '@react-router/dev/routes';

export default [
// ...your other routes
route('llms.txt', 'routes/llms-txt.ts'),
] satisfies RouteConfig;

```
app/routes/llms-txt.ts    Copy     

```
// app/routes/llms-txt.ts
// Resource route: it exports a loader and no default component.
// Served at /llms.txt via route('llms.txt', 'routes/llms-txt.ts') in app/routes.ts
import type { Route } from './+types/llms-txt';

export async function loader(_: Route.LoaderArgs) {
const content = `# Your Site

> One-sentence description of what your site or product does.

## Documentation

- [Getting Started](https://yoursite.com/docs/start): Install and configure.
- [API Reference](https://yoursite.com/docs/api): Full endpoint catalog.

## Product

- [Overview](https://yoursite.com/product): Features and capabilities.
- [Pricing](https://yoursite.com/pricing): Plans and billing.

## Optional

- [Changelog](https://yoursite.com/changelog): Release history.
- [GitHub](https://github.com/your-org/your-repo): Source code.
`;

return new Response(content, {
status: 200,
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',
},
});
}

```

If your app uses file-based routing through `@react-router/fs-routes`, the
`[.]` escape still maps a file named `llms[.]txt.ts` to `/llms.txt`:
app/routes.ts, flatRoutes() alternative    Copy     

```
// app/routes.ts, file-based alternative
import { type RouteConfig } from '@react-router/dev/routes';
import { flatRoutes } from '@react-router/fs-routes';

export default flatRoutes() satisfies RouteConfig;

// With flatRoutes(), name the module app/routes/llms[.]txt.ts:
// the [.] escapes the dot, so the URL is /llms.txt

```

Example

Return a Response with text/plain

For resource routes consumed outside your UI, the React Router docs recommend returning
Response  instances so the encoding stays explicit. JSON helpers such as  Response.json()  set a JSON content type; for  llms.txt  use  new Response(body, { headers: { 'Content-Type': 'text/plain;
charset=utf-8' } }) .

For dynamic generation from your content layer, fetch docs in the loader and build the Markdown
link list programmatically:
app/routes/llms-txt.ts, dynamic    Copy     

```
// app/routes/llms-txt.ts
// Generate from your content / MDX files
import type { Route } from './+types/llms-txt';
// Your own data access module (example name)
import { getAllDocs } from '../models/docs.server';

export async function loader(_: Route.LoaderArgs) {
// Fetch your documentation index from a DB or file system
const docs = await getAllDocs();

const links = docs
.map((doc) => `- [${doc.title}](https://yoursite.com/docs/${doc.slug}/): ${doc.summary}`)
.join('\n');

const body = [
'# Your Site',
'',
'> One-sentence summary of your project.',
'',
'## Documentation',
'',
links,
].join('\n');

return new Response(body, {
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',
},
});
}

```

## Existing Remix v2 apps

If you have not migrated yet, the same idea works in Remix v2 with its flat route convention: a
module at `app/routes/llms[.]txt.ts` whose `loader` returns a plain-text
`Response`. Types come from your adapter package (`@remix-run/node`,
`@remix-run/cloudflare` or `@remix-run/deno`). For new work, the React
Router [upgrade guide](https://reactrouter.com/7.18.5/upgrading/remix) describes the migration
path.
app/routes/llms[.]txt.ts, Remix v2    Copy     

```
// app/routes/llms[.]txt.ts  (Remix v2 only)
// v2 flat route convention: [.] escapes the dot, URL is /llms.txt
import type { LoaderFunctionArgs } from '@remix-run/node'; // or cloudflare/deno

export async function loader(_: LoaderFunctionArgs) {
return new Response('# Your Site\n\n> One-sentence summary.\n', {
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
});
}

```

## Verify

After deploying, confirm the file is served correctly:
Verification    Copy     

```
curl -I https://yoursite.com/llms.txt
# Expected:
# HTTP/2 200
# content-type: text/plain; charset=utf-8

curl https://yoursite.com/llms.txt | head -5
```

## Related guides

- [How to create llms.txt](/how-to-create/), templates and checklist. 
- [llms.txt format reference](/llms-txt-format/), spec details. 
- [Vercel guide](/llms-txt-vercel/), deployment and cache headers. 
- [Cloudflare Pages guide](/llms-txt-cloudflare/), CDN config. 
- [Validator](/validator/) · [Generator](/generator/).         
## Sources

- [ llmstxt.org, community proposal ](https://llmstxt.org/)
- [ React Router, upgrading from Remix v2 ](https://reactrouter.com/7.18.5/upgrading/remix)
- [ React Router, resource routes ](https://reactrouter.com/how-to/resource-routes)
- [ React Router, routes.ts ](https://reactrouter.com/api/framework-conventions/routes.ts)
- [ React Router, file route conventions ](https://reactrouter.com/how-to/file-route-conventions)
- [ Vite, the public directory ](https://vite.dev/guide/assets)
- [ Remix (remix.run), current framework site ](https://remix.run/)
- [ Remix v2 docs, resource routes ](https://v2.remix.run/docs/guides/resource-routes/)
