Deploy to Cloudflare Pages/Workers with D1 for persistent database storage.
wrangler d1 create ai-ready-db
This outputs your database ID:
Created D1 database: ai-ready-db
Database ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
name = "my-site"
compatibility_date = "2024-01-01"
[[d1_databases]]
binding = "AI_READY_DB"
database_name = "ai-ready-db"
database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
export default defineNuxtConfig({
aiReady: {
database: {
type: 'd1',
bindingName: 'AI_READY_DB'
}
}
})
┌────────────────────────────────────────────────────────────┐
│ BUILD TIME (Local/CI) │
│ Uses SQLite to process pages │
│ Creates __ai-ready/pages.dump for initial data │
├────────────────────────────────────────────────────────────┤
│ FIRST DEPLOYMENT │
│ db-restore plugin imports dump into D1 │
│ D1 database populated with prerendered pages │
├────────────────────────────────────────────────────────────┤
│ RUNTIME │
│ D1 database persists across requests │
│ New pages indexed via afterResponse hook │
│ FTS5 search works via MCP tools │
└────────────────────────────────────────────────────────────┘
Key difference from serverless: D1 is persistent, so the dump is only imported once. Subsequent deployments with updated content will re-import the dump if the database is empty.
If using NuxtHub, D1 is provisioned automatically:
export default defineNuxtConfig({
modules: ['@nuxthub/core'],
hub: {
database: true
},
aiReady: {
database: {
type: 'd1',
bindingName: 'DB' // NuxtHub default binding
}
}
})
wrangler dev