https://github.com/dgr8akki/nextjs-llms-plugin
Generate llms.txt and llms-full.txt for Next.js apps during build.
https://github.com/dgr8akki/nextjs-llms-plugin
llms-txt nextjs npm-package typescript webpack
Last synced: 28 days ago
JSON representation
Generate llms.txt and llms-full.txt for Next.js apps during build.
- Host: GitHub
- URL: https://github.com/dgr8akki/nextjs-llms-plugin
- Owner: dgr8akki
- License: mit
- Created: 2026-06-08T21:33:04.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-06-08T22:06:39.000Z (about 1 month ago)
- Last Synced: 2026-06-08T23:21:59.154Z (about 1 month ago)
- Topics: llms-txt, nextjs, npm-package, typescript, webpack
- Language: TypeScript
- Size: 35.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: Agents.md
Awesome Lists containing this project
README
# nextjs-llms-plugin
Generate `llms.txt` and `llms-full.txt` for a Next.js app during compilation.
## Install
```sh
npm install nextjs-llms-plugin
```
## Usage
```js
// next.config.js
const { withLLMsTxt } = require('nextjs-llms-plugin');
module.exports = withLLMsTxt(
{
reactStrictMode: true,
},
{
title: 'Acme Docs',
description: 'Documentation and product pages for Acme.',
sectionMapping: {
'/docs': 'Documentation',
'/api': 'API Reference',
},
excludeRoutes: ['/admin/**'],
},
);
```
The plugin scans `app`, `src/app`, `pages`, and `src/pages`, then writes:
- `public/llms.txt`
- `public/llms-full.txt`
## Options
```ts
interface LLMsTxtOptions {
title?: string;
description?: string;
details?: string | string[];
excludeRoutes?: string[];
includeRoutes?: Array<{
title: string;
url: string;
description?: string;
section?: string;
optional?: boolean;
content?: string;
}>;
sectionMapping?: Record;
outputDir?: string;
projectDir?: string;
generateFull?: boolean;
filename?: string;
fullFilename?: string;
}
```
Static metadata is read from Markdown/MDX frontmatter and common App Router exports:
```ts
export const metadata = {
title: 'Getting started',
description: 'Install and configure the project.',
};
```
## Programmatic generation
```ts
import { generateLLMsTxt } from 'nextjs-llms-plugin';
await generateLLMsTxt({
projectDir: process.cwd(),
title: 'Acme',
description: 'Acme public site.',
});
```