llms txt

How llms.txt fits your setup

generateLlmsTxt(config, options) (root export of @rebilder/gateway) produces spec-shaped markdown (H1 site name, blockquote description, H2 sections of link lists) deterministically, with injected values only, no LLM anywhere. Same input → same output, which is why it’s safe to cache hard.

Option Type Notes
baseUrl string The store’s canonical base URL. Catalog/policy sources are called with new URL(baseUrl) to enumerate site-wide entries, so wire them to return the full list for the base URL if you want auto sections.
siteName string The H1. Injected verbatim.
description string One-line description, rendered as the blockquote. Injected verbatim.
sections LlmsTxtSection[] (optional) Manual sections: { title, links: [{ title, url, note? }] }. Links render as - [title](url): note.

Next.js route helper

app/llms.txt/route.tsCopy

// app/llms.txt/route.ts
import { createLlmsTxtRouteHandler } from '@rebilder/gateway/next'
import { gatewayConfig } from '../../lib/gateway-config'

export const GET = createLlmsTxtRouteHandler(gatewayConfig, {
  baseUrl: 'https://store.example.com',
  siteName: 'Acme Outdoors',
  description: 'Trail footwear and gear, shipped from Bend, OR.',
  sections: [{ title: 'Guides', links: [{ title: 'Sizing guide', url: 'https://store.example.com/pages/sizing' }] }],
})

The route handler serves text/plain; charset=utf-8 with long shared-cache headers (public, max-age=300, s-maxage=3600, stale-while-revalidate=86400), which is safe because the output is deterministic. trymumm.com serves its own at /llms.txt.

On other stacks, call generateLlmsTxt(config, options) yourself and serve the string from any route with the same content type.