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
- Default:
dev: Dev command override- Default:
nuxt dev
- Default:
entrypoint: Worker entrypoint path- Default:
.output/server/index.mjs
- Default:
assets: Static assets directory- Default:
.output/public
- Default:
noBundle: Skip bundling- Default:
true
- Default:
Accessing Bindings
Access Cloudflare bindings in your Nuxt application:Local Development
Thenitro-cloudflare-dev module provides:
- Local emulation of Cloudflare bindings
- Hot module replacement
- Development server with platform context
Node.js Compatibility
The Nuxt resource automatically setscompatibility: "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 inserver/api/:
Deployment Best Practices
- Use environment variables for secrets
- Configure bindings in
alchemy.run.ts - Test locally with
nitro-cloudflare-dev - Keep
.outputdirectory in.gitignore
Related Resources
- Website - Base resource for web applications
- D1 Database - SQL database
- KV Namespace - Key-value storage