A Next.js plugin for automatically generating LLM-friendly documentation following the llmstxt.org standard.
- ⚡️ Automatic Generation - Scans your Next.js app directory and generates
llms.txtandllms-full.txtfiles - 📄 Per-Page Endpoints - Generate
.html.mdendpoints for each page (e.g.,/products.html.md) - 🎯 Zero Config - Works out of the box with sensible defaults
- 🔧 Highly Customizable - Fine-tune content sources, sections, and output format
- 📝 Content Extraction - Intelligently extracts readable text from React/TSX components
- 🏗️ Build-Time Generation - Runs during Next.js build for optimal performance
- 📊 Section Grouping - Organize content by products, use cases, blog posts, etc.
- 🎨 Custom Sections - Add external links, open source projects, and more
- 📦 Multiple Output Modes - Generate as route handlers or static files
- 🔀 Dynamic Routes - Supports
[id]and[...slug]catch-all routes
npm install @turbodocx/next-plugin-llms --save-dev// next.config.ts
import { withLLMsTxt } from '@turbodocx/next-plugin-llms';
export default withLLMsTxt({
// Your Next.js config
reactStrictMode: true,
});That's it! The plugin will automatically:
- Scan your
app/directory - Extract metadata from
layout.tsxfiles - Extract content from
page.tsxfiles - Generate
app/llms.txt/route.ts(directory/index) - Generate
app/llms-full.txt/route.ts(all content combined) - Generate
app/**/*.html.md/route.ts(per-page endpoints)
// next.config.ts
import { withLLMsTxt } from '@turbodocx/next-plugin-llms';
export default withLLMsTxt({
// Next.js config
reactStrictMode: true,
}, {
// Plugin options
title: 'TurboDocx',
description: 'AI-powered document automation platform',
siteUrl: 'https://www.turbodocx.com',
// Content sources with section grouping
sources: [
{
section: 'Products',
pattern: 'app/products/**',
priority: 'high',
description: 'Core product offerings'
},
{
section: 'Use Cases',
pattern: 'app/use-cases/**',
priority: 'medium'
},
{
section: 'Blog',
pattern: 'app/blog/**',
priority: 'medium'
},
],
// Custom sections (external links, open source, etc.)
customSections: [
{
title: 'Open Source',
description: 'Our open source contributions',
items: [
{
title: '@turbodocx/html-to-docx',
url: 'https://github.com/TurboDocx/html-to-docx',
description: 'Convert HTML to DOCX - 26,000+ downloads'
},
{
title: 'GitHub',
url: 'https://github.com/TurboDocx'
}
]
},
{
title: 'Documentation',
items: [
{
title: 'API Reference',
url: 'https://docs.turbodocx.com/API'
}
]
}
],
// Exclude specific routes
excludePatterns: [
'**/admin/**',
'**/internal/**'
],
// Content processing
contentOptions: {
stripJsx: true,
preserveMarkdown: true,
maxContentLength: 50000
}
});| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
true |
Enable/disable the plugin |
generateLLMsTxt |
boolean |
true |
Generate llms.txt file |
generateLLMsFullTxt |
boolean |
true |
Generate llms-full.txt file |
title |
string |
- | Site title (falls back to Next.js metadata) |
description |
string |
- | Site description |
siteUrl |
string |
- | Base URL of your site |
appDir |
string |
'app' |
Path to app directory |
generatePerPageMarkdown |
boolean |
true |
Generate per-page .html.md endpoints |
perPageOptions |
PerPageOptions |
- | Per-page generation options |
Enabled by default! Individual .html.md route handlers are generated for each page, allowing LLMs to fetch specific page content efficiently:
{
generatePerPageMarkdown: true,
perPageOptions: {
outputType: 'route-handler', // 'route-handler' or 'static'
includeMetadata: true, // Include frontmatter metadata
includePatterns: ['products/**', 'blog/**'], // Only generate for these pages
excludePatterns: ['**/admin/**'] // Exclude these pages
}
}Generated Output:
app/
├── products.html.md/
│ └── route.ts → Serves markdown for /products
├── products/
│ └── shoes.html.md/
│ └── route.ts → Serves markdown for /products/shoes
└── blog/
└── [slug].html.md/
└── route.ts → Serves markdown for /blog/:slug
Markdown Format:
---
title: Products
description: Our product catalog
url: https://example.com/products
---
# Products
> Our product catalog
Main page content here...PerPageOptions:
| Option | Type | Default | Description |
|---|---|---|---|
outputType |
'route-handler' | 'static' |
'route-handler' |
Generate route handlers or static files |
includeMetadata |
boolean |
true |
Include frontmatter with metadata |
includePatterns |
string[] |
[] |
Only generate for matching pages |
excludePatterns |
string[] |
[] |
Exclude matching pages |
| Option | Type | Default | Description |
|---|---|---|---|
includePatterns |
string[] |
['**/*.tsx', '**/*.ts'] |
Files to include |
excludePatterns |
string[] |
['**/api/**', '**/_*.tsx'] |
Files to exclude |
sources |
ContentSource[] |
[] |
Content sources with sections |
| Option | Type | Default | Description |
|---|---|---|---|
outputType |
'route-handler' | 'static' |
'route-handler' |
Output format |
outputPath |
object |
- | Custom output paths |
| Option | Type | Default | Description |
|---|---|---|---|
contentOptions.stripJsx |
boolean |
true |
Strip JSX tags |
contentOptions.preserveMarkdown |
boolean |
true |
Preserve markdown formatting |
contentOptions.maxContentLength |
number |
50000 |
Max content per page |
Generate additional LLM files for specific sections:
customFiles: [
{
filename: 'llms-products.txt',
title: 'TurboDocx Products',
description: 'Complete product documentation',
includePatterns: ['app/products/**'],
fullContent: true
},
{
filename: 'llms-api.txt',
title: 'Developer Documentation',
description: 'API and integration guides',
includePatterns: ['app/use-cases/developers/**'],
fullContent: true
}
]Content sources allow you to organize your documentation into logical sections:
sources: [
{
section: 'Products',
pattern: 'app/products/**',
priority: 'high', // high, medium, low
description: 'Product pages'
},
{
section: 'Use Cases',
pattern: 'app/use-cases/**',
priority: 'medium'
}
]Priority levels:
high: Appears first in llms.txtmedium: Appears in middlelow: Appears last
Add external links or static content that isn't part of your Next.js app:
customSections: [
{
title: 'External Resources',
description: 'Additional documentation and tools',
items: [
{
title: 'API Documentation',
url: 'https://docs.example.com',
description: 'Complete API reference'
},
{
title: 'GitHub Repository',
url: 'https://github.com/example/repo'
}
]
}
]Generates Next.js route handlers:
app/
├── llms.txt/
│ └── route.ts
└── llms-full.txt/
└── route.ts
Files are served at /llms.txt and /llms-full.txt.
Generates static text files:
outputType: 'static'public/
├── llms.txt
└── llms-full.txt
- Scan - Recursively scans your
app/directory forpage.tsxfiles - Extract Metadata - Reads
layout.tsxfiles to get titles, descriptions, and OpenGraph data - Extract Content - Parses React/TSX components to extract readable text
- Group - Organizes routes by sections based on your configuration
- Generate - Creates
llms.txtandllms-full.txtfiles following the llmstxt.org standard
# TurboDocx
> AI-powered document automation platform
## Products
- [TurboDocx Templating](https://www.turbodocx.com/products/turbodocx-templating): Create templates with drag-and-drop
- [TurboDocx Writer](https://www.turbodocx.com/products/turbodocx-writer): AI-powered document creation
- [TurboSign](https://www.turbodocx.com/products/turbosign): Digital signatures at 50% lower cost
## Use Cases
- [IT Teams](https://www.turbodocx.com/use-cases/it-teams): Automate SOWs and technical docs
- [Sales Teams](https://www.turbodocx.com/use-cases/sales-teams): Generate proposals faster
## Open Source
- [@turbodocx/html-to-docx](https://github.com/TurboDocx/html-to-docx): Convert HTML to DOCXIncludes complete content for each page with headings, descriptions, and full text.
You can also generate files manually:
import { generateLLMFiles } from '@turbodocx/next-plugin-llms';
await generateLLMFiles({
title: 'My Site',
description: 'My documentation',
appDir: 'app',
});# In plugin directory
cd next-plugin-llms
npm install
npm run build
npm link
# In your Next.js project
npm link @turbodocx/next-plugin-llms// package.json
{
"dependencies": {
"@turbodocx/next-plugin-llms": "file:../next-plugin-llms"
}
}See the examples directory for complete usage examples.
| Feature | Manual | Docusaurus Plugin | Next Plugin |
|---|---|---|---|
| Auto-updates | ❌ | ✅ | ✅ |
| Next.js App Router | ❌ | ✅ | |
| Custom sections | ✅ | ✅ | |
| Build integration | ❌ | ✅ | ✅ |
| Content extraction | ❌ | ✅ Markdown | ✅ React/TSX |
- Node.js >= 18
- Next.js >= 14
- Next.js App Router (not Pages Router)
Contributions welcome! Please open an issue or PR.
Discover our suite of open-source tools and integrations for document automation:
| Package | Description | Downloads |
|---|---|---|
| @turbodocx/html-to-docx | Convert HTML to DOCX with comprehensive formatting support, SVG handling, and full CSS styling | |
| @turbodocx/next-plugin-llms | Next.js plugin for generating LLM-friendly documentation (llms.txt) | |
| n8n-nodes-turbodocx | TurboDocx node for n8n workflow automation - connect with 400+ apps |
- TurboDocx Platform - Enterprise document automation with AI-powered templating
- TurboSign - Free E-Signature
- API Documentation - Complete REST API reference
- GitHub Organization - All open-source projects
- npm Packages - Published packages
MIT
- docusaurus-plugin-llms - LLM plugin for Docusaurus
- vitepress-plugin-llms - LLM plugin for VitePress
- llmstxt.org - Official llms.txt specification
Proudly Built by TurboDocx

