LLMs
Learn how to use nuxt-llms to generate llms.txt documentation for your Nuxt application.
This starter kit uses the nuxt-llms module to automatically generate llms.txt and llms-full.txt documentation files for your application.
These files make your application's content discoverable and consumable by AI assistants and large language models.
Configuration
The module is configured in nuxt.config.ts:
export default defineNuxtConfig({
modules: ['nuxt-llms'],
llms: {
domain: 'https://your-domain.com',
title: 'Your Application',
description: 'A short description of your application.',
full: {
title: 'Your Application – Full Documentation',
description: 'Complete documentation of your application.',
},
},
})
After starting your application, visit /llms.txt and /llms-full.txt to see the generated documentation.
Extending the Documentation
You can dynamically extend both documentation formats via Nitro server plugins.
llms.txt
Use the llms:generate hook to add sections and links to /llms.txt:
// server/plugins/llms.ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('llms:generate', async (event, options) => {
options.sections.push({
title: 'API Documentation',
description: 'REST API endpoints and usage.',
links: [
{
title: 'Authentication',
description: 'API authentication methods.',
href: `${options.domain}/api/auth`,
},
],
})
})
})
llms-full.txt
Use the llms:generate:full hook to add free-form Markdown content to /llms-full.txt:
// server/plugins/llms.ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('llms:generate:full', async (event, options, contents) => {
contents.push(`## API Authentication
Use a Bearer token in the \`Authorization\` header to authenticate requests.`)
})
})