Skip to main content
Deploy Nuxt applications to Cloudflare Workers using the cloudflare-module preset.

Installation

Install the required dependencies:

Configuration

Configuration Options

Properties

  • bindings: Cloudflare bindings (KV, R2, D1, etc.)
  • build: Build command override
    • Default: nuxt build
  • dev: Dev command override
    • Default: nuxt dev
  • entrypoint: Worker entrypoint path
    • Default: .output/server/index.mjs
  • assets: Static assets directory
    • Default: .output/public
  • noBundle: Skip bundling
    • Default: true

Accessing Bindings

Access Cloudflare bindings in your Nuxt application:

Local Development

The nitro-cloudflare-dev module provides:
  • Local emulation of Cloudflare bindings
  • Hot module replacement
  • Development server with platform context
Start the dev server:

Node.js Compatibility

The Nuxt resource automatically sets compatibility: "node" for Node.js API support. This enables:
  • Node.js built-in modules
  • npm packages that depend on Node.js APIs
  • Full Nuxt feature set

Build Optimization

Customize the build process:

Server Routes

Create server API routes in server/api/:

Deployment Best Practices

  • Use environment variables for secrets
  • Configure bindings in alchemy.run.ts
  • Test locally with nitro-cloudflare-dev
  • Keep .output directory in .gitignore