Deploy

Cloudflare Workers

Deploy your Content app to Cloudflare Workers

Quick Setup

  1. Use cloudflare_module preset and compatibility date of 2024-09-19 or later.
  2. Create a D1 database and connect it to your project in the Cloudflare Dashboard under the DB binding name, and configure the database configuration in the nuxt.config.ts file.
  3. Build and deploy your app

The Nuxt Content module has a built-in integration with Cloudflare Workers to deploy your content.

The module will automatically detect the build target and prepare the necessary configuration for Cloudflare Workers.

All you need to do is create a Cloudflare D1 database and connect it to your project. After creating a D1 database, you should define the database configuration in the nuxt.config.ts file with the nitro.cloudflare.wrangler.d1_databases option.

By default, the module will use the DB binding name. You can override the database configuration by providing your own database configuration in nuxt.config.ts.

nuxt.config.ts
export default defineNuxtConfig({
  compatibilityDate: "2025-05-15",
  nitro: {
    preset: 'cloudflare_module',
    cloudflare: {
      deployConfig: true,
      wrangler: {
        d1_databases: [
          {
            binding: 'DB',
            database_name: 'database-name',
            database_id: '*********-***-****-****-*********'
          }
        ]
      },
    },
  }
})
If you want to use a different binding name, you can override the database configuration by providing your own database configuration in nuxt.config.ts. Check out Database Configuration
To deploy a Nuxt project to Cloudflare Workers, you need to use a compatibility date of 2024-09-19 or later.

Build your project with the nuxi build command, and you can deploy the project with the wrangler deploy command.

npx wrangler deploy

That's it! 🎉

Check out: