Skip to content

Generate llms.txt for Your Nuxt App

Generate llms.txt and llms-full.txt with nuxt-llms so AI assistants can read your docs and blog posts, and extend both files with Nitro server plugins.

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 registered in the core layer and configured in apps/web/layers/core/nuxt.config.ts. It takes the title, description and domain from packages/site-config:

export default defineNuxtConfig({
  llms: {
    description: 'A short description of your application.',
    domain: 'https://your-domain.com',
    full: {
      description: 'Complete documentation of your application.',
      title: 'Your Application – Full Documentation',
    },
    title: 'Your Application',
  },
  modules: ['nuxt-llms'],
})

After starting your application, visit /llms.txt and /llms-full.txt to see the generated documentation. The links in /llms.txt are absolute, and /llms-full.txt contains the docs and blog posts.

The docs and blog posts are also available as Markdown under /raw/….

The AI-ready module of @nuxtjs/seo is disabled, because it would write /llms.txt as well. There are no Markdown copies of other pages (like /pricing.md).

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({
      description: 'REST API endpoints and usage.',
      links: [
        {
          description: 'API authentication methods.',
          href: `${options.domain}/api/auth`,
          title: 'Authentication',
        },
      ],
      title: 'API Documentation',
    })
  })
})

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.`)
  })
})

Learn More