Deploy an existing project
Wrangler can automatically detect your framework and configure your project for Cloudflare Workers. This allows you to deploy existing projects with a single command, without manually setting up configuration files or installing adapters.
When you run wrangler deploy or wrangler setup in a project directory without a Wrangler configuration file, Wrangler will:
- Detect your framework - Analyzes your project to identify the framework you're using
- Prompt for confirmation - Shows the detected settings and asks you to confirm before making changes
- Install adapters - Installs any required Cloudflare adapters for your framework
- Generate configuration - Creates a
wrangler.jsoncfile with appropriate settings - Update package.json - Adds helpful scripts like
deploy,preview, andcf-typegen - Configure git - Adds Wrangler-specific entries to
.gitignore
Automatic configuration supports the following frameworks:
| Framework | Adapter/Tool | Notes |
|---|---|---|
| Next.js | @opennextjs/cloudflare | Runs @opennextjs/cloudflare migrate automatically. R2 caching is configured if available. |
| Astro | @astrojs/cloudflare | Runs astro add cloudflare automatically |
| SvelteKit | @sveltejs/adapter-cloudflare | Runs sv add sveltekit-adapter automatically |
| Nuxt | Built-in Cloudflare preset | |
| React Router | Cloudflare Vite plugin | |
| Solid Start | Built-in Cloudflare preset | |
| TanStack Start | Cloudflare Vite plugin | |
| Angular | ||
| Analog | Built-in Cloudflare preset | |
| Vite | Cloudflare Vite plugin | |
| Vike | ||
| Waku | ||
| Static sites | None | Any directory with an index.html |
Automatic configuration may also work with other projects, such as React or Vue SPAs. Try running wrangler deploy or wrangler setup to see if your project is detected.
When automatic configuration runs, the following files may be created or modified:
A new Wrangler configuration file is created with settings appropriate for your framework:
{ "$schema": "node_modules/wrangler/config-schema.json", "name": "my-project", "main": "dist/_worker.js/index.js", // Set this to today's date "compatibility_date": "2026-03-09", "compatibility_flags": ["nodejs_compat"], "assets": { "binding": "ASSETS", "directory": "dist", }, "observability": { "enabled": true, },}"$schema" = "node_modules/wrangler/config-schema.json"name = "my-project"main = "dist/_worker.js/index.js"# Set this to today's datecompatibility_date = "2026-03-09"compatibility_flags = [ "nodejs_compat" ]
[assets]binding = "ASSETS"directory = "dist"
[observability]enabled = trueThe exact configuration varies based on your framework.
New scripts are added to your package.json:
{ "scripts": { "deploy": "npm run build && wrangler deploy", "preview": "npm run build && wrangler dev", "cf-typegen": "wrangler types" }}Wrangler-specific entries are added:
# wrangler files.wrangler.dev.vars*!.dev.vars.exampleFor frameworks that generate worker files in the output directory, an .assetsignore file is created to exclude them from static asset uploads:
_worker.js_routes.jsonTo deploy an existing project, run wrangler deploy in your project directory:
npx wrangler deployyarn wrangler deploypnpm wrangler deployWrangler will detect your framework, show the configuration it will apply, and prompt you to confirm before making changes and deploying.
To configure your project without deploying, use wrangler setup:
npx wrangler setupyarn wrangler setuppnpm wrangler setupThis is useful when you want to review the generated configuration before deploying.
To see what changes would be made without actually modifying any files:
npx wrangler setup --dry-runyarn wrangler setup --dry-runpnpm wrangler setup --dry-runThis outputs a summary of the configuration that would be generated.
To skip the confirmation prompts, use the --yes flag:
npx wrangler deploy --yesyarn wrangler deploy --yespnpm wrangler deploy --yesThis applies the configuration automatically using sensible defaults. This is useful in CI/CD environments or when you want to accept the detected settings without reviewing them.
When you import a GitHub or GitLab repository via the Cloudflare dashboard, autoconfig runs non-interactively. If your repository does not have a Wrangler configuration file, Workers Builds will create a pull request with the necessary configuration.
The PR includes all the configuration changes described above. A preview deployment is generated so you can test the changes before merging. Once merged, your project is ready for deployment.
For more details, refer to Automatic pull requests.
If you do not want automatic configuration to run, ensure you have a valid Wrangler configuration file (wrangler.toml, wrangler.json, or wrangler.jsonc) in your project before running wrangler deploy.
You can also manually configure your project by following the framework-specific guides in the Framework guides.
For Next.js projects, automatic configuration will set up R2 for caching if your Cloudflare account has R2 enabled. R2 caching improves performance for Incremental Static Regeneration (ISR) ↗ and other Next.js caching features.
- If R2 is enabled on your account: Automatic configuration creates an R2 bucket and configures caching automatically.
- If R2 is not enabled: Your project will be configured without caching. You can enable R2 later and manually configure caching by following the OpenNext caching documentation ↗.
To check if R2 is enabled or to enable it, go to Storage & Databases > R2 in the Cloudflare dashboard ↗.
When you import a repository via Workers Builds in the Cloudflare dashboard, automatic configuration will fail if your project contains multiple frameworks. To resolve this, set the root directory to the path containing only one framework. For monorepos, refer to monorepo setup.
When running wrangler deploy or wrangler setup locally, Wrangler will prompt you to select which framework to use if multiple frameworks are detected.
If your framework is not detected, ensure your package.json includes the framework as a dependency.
If a Wrangler configuration file already exists, automatic configuration will not run. To reconfigure your project, delete the existing configuration file and run wrangler deploy or wrangler setup again.
Support for monorepos and npm/yarn/pnpm workspaces is currently limited. Wrangler analyzes the project directory where you run the command, but does not detect dependencies installed at the workspace root. This can cause framework detection to fail if the framework is listed as a dependency in the workspace's root package.json rather than in the individual project's package.json.
If you encounter issues, report them in the Wrangler GitHub repository ↗.