Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/src/app/llms.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ROOT_LLMS_TXT_CACHE_HEADERS, setDocsCacheHeaders } from "@/proxy";

const LLMS_TXT = `# docs.page

> docs.page hosts agent-ready documentation from any GitHub Markdown repository — with search, AI chat, an MCP server, and llms.txt — and no build step.

## Documentation
- [Documentation](https://use.docs.page): full product documentation
- [Get started](https://use.docs.page/quickstart): quickstart guide
- [CLI](https://use.docs.page/reference/cli): local preview and project tooling
- [GitHub](https://github.com/invertase/docs.page): source repository (Apache-2.0)

## Agent surfaces
Every site hosted on docs.page exposes machine-readable endpoints at a predictable per-repository pattern, where \`{owner}/{repo}\` is the backing GitHub repository:
- \`https://docs.page/{owner}/{repo}/llms.txt\`: LLM-oriented index of the site's pages
- \`https://docs.page/{owner}/{repo}/llms-full.txt\`: full concatenated Markdown of the site
- \`https://docs.page/{owner}/{repo}/mcp\`: Model Context Protocol server (tools: read_doc_page, list_doc_files)
- \`https://docs.page/{owner}/{repo}/search.json\`: search index
- Append \`.md\` or \`.mdx\` to any documentation page URL to fetch its raw Markdown source
`;

export function GET() {
const response = new Response(LLMS_TXT, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
setDocsCacheHeaders(response.headers, ROOT_LLMS_TXT_CACHE_HEADERS);
return response;
}
10 changes: 10 additions & 0 deletions app/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ export const LLMS_FULL_TXT_CACHE_HEADERS = buildCdnCacheHeaders({
staleWhileRevalidate: CDN_STALE_SECONDS,
staleIfError: CDN_STALE_SECONDS,
});
/**
* Root product-level `llms.txt`: a hand-written static file that changes rarely,
* so it tolerates a day-long edge TTL and hourly browser revalidation.
*/
export const ROOT_LLMS_TXT_CACHE_HEADERS = buildCdnCacheHeaders({
edgeMaxAgeSeconds: SECONDS_PER_DAY,
staleWhileRevalidate: CDN_STALE_SECONDS,
staleIfError: CDN_STALE_SECONDS,
browserMaxAgeSeconds: 60 * 60,
});
export const SITEMAP_CACHE_HEADERS = buildCdnCacheHeaders({
edgeMaxAgeSeconds: 3600,
staleWhileRevalidate: CDN_STALE_SECONDS,
Expand Down
Loading