Deploy to Cloudflare
This guide deploys a working local application to Cloudflare Workers. You need a Cloudflare account and committed SQL migrations.
1. Prepare the Worker Build
Your project needs a Worker build command and a wrangler.jsonc file containing
at least name and main.
For a new Nuxt project, the initializer prepares both:
pnpm dlx @cloudconfig/core@beta init blog-app --target nuxt --cloudflare
The standalone initializer also prepares a Worker entry. In an existing project, check the generated setup before continuing; you do not need to create another application to redeploy it.
Select Cloudflare in your existing config:
deploy: {
target: 'cloudflare',
}
Nuxt's Nitro preset follows this setting, including in older projects that still
set cloudconfig.cloudflare: true in nuxt.config.ts.
2. Sign In to Cloudflare
From your project, install Wrangler if it is missing and authenticate:
pnpm add -D wrangler
pnpm exec wrangler login
In CI, use CLOUDFLARE_API_TOKEN instead of an interactive login.
3. Preview and Deploy
Preview the deployment before changing resources:
pnpm exec cloudconfig deploy --dry-run
The Cloudflare dry run validates the build, migrations, bindings, and required secrets without changing remote resources.
Deploy after reviewing the plan:
pnpm exec cloudconfig deploy
CloudConfig builds the Worker, creates and binds D1 if needed, checks the remote schema, applies pending migrations, publishes the Worker, and uploads secrets. Configured R2 storage is also provisioned and bound.
4. Check the Live API
Open the printed URL and /api/_docs. Test sign-in, create a record, and read it
back. If deployment is blocked, use Troubleshooting
to identify the missing setting or migration issue.
You can add a custom domain
after the application works on its workers.dev URL.