Nuxt + AI Readiness
Nuxt's universal rendering is great for AI, but missing llms.txt and structured data leave your app invisible. Here's how to fix it.
Why Nuxt Apps Need AI Optimization
Nuxt 3 with Nitro provides excellent SSR by default, but most apps still lack the files and metadata AI agents need to discover and understand your content.
No llms.txt
AI models can't get a structured overview of your site without llms.txt — Nuxt doesn't generate it by default.
Missing nuxt-llms module
The nuxt-llms module auto-generates llms.txt from your content, but most apps don't have it installed.
SPA mode pages
Pages using routeRules with SPA mode or ssr: false are invisible to AI crawlers.
No agent discovery files
If your app runs an A2A agent, agent-card.json and .well-known/ endpoints aren't set up, so other agents can't discover it.
What w2agent Generates
After auditing your Nuxt app, w2agent generates Nitro-native files:
server/routes/llms.txt.tsNitro cached event handler with 1hr SWR cache — reads from public/ or generates fallback.
server/middleware/content-negotiation.tsRedirects AI agents requesting text/markdown at root to /index.md (with Vary: Accept), and text/plain to /llms.txt.
server/routes/index.md.tsServes your llms.txt content as text/markdown at /index.md, the markdown version of your homepage.
public/llms.txtStatic fallback served directly by Nitro — works on any hosting.
server/routes/.well-known/agent-card.json.tsCached A2A agent card handler — generated only when you provide your A2A endpoint (--a2a-endpoint).
Example: Nitro cached handler for llms.txt
// server/routes/llms.txt.ts
import { defineCachedEventHandler } from "#imports";
export default defineCachedEventHandler(
async () => {
const fs = await import("node:fs");
const path = await import("node:path");
const filePath = path.join(process.cwd(), "public", "llms.txt");
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath, "utf-8");
}
return "# My Site\n\n> AI-ready content\n";
},
{ swr: true, maxAge: 3600 },
);Nuxt-Specific Checks
| Check | What It Tests |
|---|---|
| SEO module detection | Checks if @nuxtjs/seo is installed for automatic sitemap, robots.txt, and meta tag generation. |
| LLMs module detection | Detects nuxt-llms for automatic llms.txt generation from your Nuxt content. |
| Schema.org coverage | Validates JSON-LD structured data across pages, including @nuxtjs/schema-org usage. |
| SSR rendering verification | Ensures pages are server-rendered, not SPA-only — AI crawlers need pre-rendered HTML. |
Step-by-Step Integration
Install the npm module
npm install @w2agent/nuxtAdd to nuxt.config.ts
Add '@w2agent/nuxt' to modules and set w2agent: { siteUrl: 'https://your-site.com' }. The module auto-registers Nitro routes for llms.txt, agent-card, and content negotiation.
Deploy
Deploy to any Nitro-compatible host. Content regenerates at build time via postbuild hook.
Alternative: run the CLI instead
npx w2agent integrate https://your-nuxt-app.com --installScore your Nuxt site now
Get your free w2agent score and generate the files your site needs.
Get Your ScoreRun from your terminal
npx w2agent audit https://example.comnpx w2agent generate https://example.comnpx w2agent integrate https://example.comnpx w2agent agentize https://example.com