Cloudflare Pages
Quick Setup
- Use
nuxi build --preset=cloudflare_pagesto build your app - Create D1 database and connect to your project in Cloudflare Dashboard under
DBbinding name - Deploy/Redeploy your app
Nuxt Content module has a built-in integration with Cloudflare Pages to deploy your content.
Module will automatically detects the build target and prepare the necessary configuration for Cloudflare Pages.
You can either use --preset=cloudflare_pages option on nuxi build command or use nuxt.config.ts to configure the preset.
export default defineNuxtConfig({
nitro: {
preset: 'cloudflare_pages',
},
});
The module requires a D1 database to be connected to the app in order to work. By default it will use the DB binding name. You can override the database configuration by providing your own database configuration in nuxt.config.ts.
After creating a new Cloudflare Pages project, you need to create a new D1 database and connect it to the project. Make sure to use the same binding name as the module is using. (default is DB)
That's it 🎉
Checkout: