wrangler setup command automatically configures your project to deploy to Cloudflare by detecting your framework and adding the necessary configuration.
Options
Answer โyesโ to any prompts for configuring your project
Run your projectโs build command once it has been configured
Runs the command without applying any filesystem modifications
What It Does
Thewrangler setup command:
- Detects your framework - Automatically identifies popular frameworks (Next.js, Remix, SvelteKit, Astro, Nuxt, etc.)
- Adds Wrangler configuration - Creates or updates
wrangler.jsonwith appropriate settings - Installs dependencies - Adds necessary packages for Cloudflare deployment
- Configures build settings - Sets up build commands and output directories
- Creates deployment script - Adds a deploy script to your
package.json
Example
Supported Frameworks
Wrangler automatically detects and configures:- Next.js - Configures for Pages with static export or SSR
- Remix - Sets up Cloudflare Workers adapter
- SvelteKit - Configures Cloudflare adapter
- Astro - Sets up Cloudflare adapter
- Nuxt - Configures Cloudflare preset
- Solid Start - Sets up Cloudflare adapter
- Qwik - Configures Cloudflare adapter
- Analog - Sets up Cloudflare adapter
- React (Vite/Create React App) - Configures for static deployment
- Vue - Sets up for static deployment
- Angular - Configures for static deployment
Complete Workflow
Run setup
- Detect your framework
- Ask for confirmation before making changes
- Install required packages
- Update configuration files
Review the changes
Check the generated
wrangler.json and updated package.json:wrangler.json
package.json
Interactive Setup Example
When you runwrangler setup, youโll see prompts like:
Configuration Output
After setup, your project will have:wrangler.json
wrangler.json
package.json Updates
package.json
Dry Run Mode
Use--dry-run to preview changes without applying them:
Auto-Confirm Mode
Skip all prompts with--yes:
- CI/CD pipelines
- Automated project initialization
- When you trust the auto-detected configuration
Framework-Specific Configuration
Next.js
@cloudflare/next-on-pagespackage- Cloudflare adapter to
next.config.js - Build output directory configuration
Remix
@remix-run/cloudflareadapter- Cloudflare preset to
remix.config.js - Worker configuration
SvelteKit
@sveltejs/adapter-cloudflarepackage- Adapter configuration to
svelte.config.js - Build settings
Manual Configuration
If auto-detection doesnโt work for your project, you can manually createwrangler.json:
wrangler.json
Completion Message
After successful setup, youโll see:Troubleshooting
Framework not detected: If your framework isnโt automatically detected, you can:- Manually create
wrangler.json - Use
wrangler initfor a basic Worker project - Check if your framework has a Cloudflare adapter package
Next Steps After Setup
-
Test locally
-
Configure environment variables
-
Deploy to production
-
Set up CI/CD
Add
npm run deployto your GitHub Actions or other CI pipeline
Best Practices
- Run setup in a clean working directory - Commit or stash changes before running setup
- Review changes - Check what files were modified after setup completes
- Test deployment locally first - Use
wrangler pages devbefore deploying - Use version control - Commit
wrangler.jsonandpackage.jsonchanges - Update compatibility date - Keep the
compatibility_dateinwrangler.jsoncurrent