Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
pcx_content_type: navigation
title: Supported bindings in local and remote dev
title: Supported bindings per development mode
sidebar:
order: 4
head: []
description: Supported bindings in local and remote development
description: Supported bindings per development mode
---

import { Render } from "~/components";
Expand Down
361 changes: 361 additions & 0 deletions src/content/docs/workers/development-testing/index.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
pcx_content_type: navigation
title: Local data
title: Adding local data
sidebar:
order: 2
order: 4
head: []
description: Working with data during local development
description: Populating local resources with data
---

import {
Expand Down
7 changes: 7 additions & 0 deletions src/content/docs/workers/development-testing/testing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
pcx_content_type: navigation
title: Testing
external_link: /workers/testing/
sidebar:
order: 7
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
pcx_content_type: navigation
title: Vite Plugin
external_link: /workers/vite-plugin/
sidebar:
order: 1
---
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
---
pcx_content_type: navigation
title: Local development
title: Choosing between Wrangler & Vite
sidebar:
order: 6
order: 3
head: []
description: Develop your Workers locally.
description: Choosing between Wrangler and Vite for local development
---

import { Details, LinkCard, Render, PackageManagers } from "~/components";

When building projects on Cloudflare Workers, you have two options for local development:

- [**Wrangler**](/workers/wrangler/), using the built-in [`wrangler dev`](/workers/wrangler/commands/#dev) command.
- [Vite](https://vite.dev/), using the [**Cloudflare Vite plugin**](/workers/vite-plugin/).

Both Wrangler and the Vite plugin use [Miniflare](/workers/testing/miniflare/) to provide an accurate **local** simulation of the Cloudflare Workers runtime, ([`workerd`](https://github.com/cloudflare/workerd)). If you need to [develop with **remote resources**](/workers/local-development/remote-data/), Wrangler is the only option, and provides remote development via the `wrangler dev --remote` command.

## Choosing between Wrangler or Vite
# When to use Wrangler vs Vite

Deciding between Wrangler and the Cloudflare Vite plugin depends on your project's focus and development workflow. Here are some quick guidelines to help you choose:

### When to use Wrangler
## When to use Wrangler

- **Backend & Workers-focused:**
If you're primarily building APIs, serverless functions, or background tasks, use Wrangler.
Expand All @@ -31,7 +22,7 @@ Deciding between Wrangler and the Cloudflare Vite plugin depends on your project
- **Simple frontends:**
If you have minimal frontend requirements and don’t need hot reloading or advanced bundling, Wrangler may be sufficient.

### When to use the Cloudflare Vite Plugin
## When to use the Cloudflare Vite Plugin

Use the [Vite plugin](/workers/vite-plugin/) for:

Expand Down
53 changes: 0 additions & 53 deletions src/content/docs/workers/local-development/remote-data.mdx

This file was deleted.

60 changes: 29 additions & 31 deletions src/content/partials/workers/bindings_per_env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@
{}
---

**Local Development:** Includes [`wrangler dev`](/workers/wrangler/commands/#dev) (without the `--remote` flag) and the [Cloudflare Vite plugin](/workers/vite-plugin/). This mode simulates the Cloudflare Workers environment locally.

**Remote Development:** Uses [`wrangler dev --remote`](/workers/wrangler/commands/#dev)), deploying your code to Cloudflare’s infrastructure during development. This ensures all bindings and resources match production conditions. There is **no Vite plugin equivalent** for testing remote resources.

| Binding | Local (Wrangler & Vite) | Remote (Wrangler only) |
| --------------------------------------- | :---------------------: | :--------------------: |
| **AI** | ✅[^1] | ✅ |
| **Assets** | ✅ | ✅ |
| **Analytics Engine** | ✅[^4] | ✅ |
| **Browser Rendering** | ❌ | ✅ |
| **D1** | ✅ | ✅ |
| **Durable Objects** | ✅ | ✅ |
| **Email Bindings** | ✅ | ✅ |
| **Hyperdrive** | ✅[^2] | ✅ |
| **Images** | ✅ | ✅ |
| **KV** | ✅ | ✅ |
| **mTLS** | ❌ | ✅ |
| **Queues** | ✅ | ❌ |
| **R2** | ✅ | ✅ |
| **Rate Limiting** | ✅ | ✅ |
| **Service Bindings (multiple Workers)** | ✅ | ✅ |
| **Vectorize** | ✅[^3] | ✅ |
| **Workflows** | ✅ | ❌ |
The three development modes differ in [**where your Worker executes** and **how bindings connect**](/workers/development-testing/#core-concepts):

**Local Development:** [Worker execution](/workers/development-testing/#worker-execution) runs locally on your machine. [Bindings](/workers/development-testing/#bindings) connect to local resource simulations. Supported in both [`wrangler dev`](/workers/wrangler/commands/#dev) and the [Cloudflare Vite plugin](/workers/vite-plugin/).

**Hybrid Development:** [Worker execution](/workers/development-testing/#worker-execution-1) runs locally on your machine. [Bindings](/workers/development-testing/#bindings-1) can connect to local simulations (default) or remote resources via `experimental_remote: true` configuration. Supported in both [`wrangler dev --x-hybrid-dev`](/workers/development-testing/#hybrid-development) and the Cloudflare Vite plugin.

**Remote Development:** [Worker execution](/workers/development-testing/#worker-execution-2) runs on Cloudflare's infrastructure. [Bindings](/workers/development-testing/#bindings-2) always connect to remote resources. Supported only in [`wrangler dev --remote`](/workers/wrangler/commands/#dev) - there is **no Vite plugin equivalent**.

| Binding | Local dev | Hybrid dev | Remote dev |
| --------------------------------------- | :-------: | :--------: | :--------: |
| **AI** | ✅[^1] | ✅ [**Recommended**](/workers/development-testing/#workers-ai) | ✅ |
| **Assets** | ✅ | ❌ | ✅ |
| **Analytics Engine** | ✅[^4] | ❌ | ✅ |
| **Browser Rendering** | ❌ | ✅ [**Recommended**](/workers/development-testing/#browser-rendering) | ✅ |
| **D1** | ✅ | ✅ | ✅ |
| **Durable Objects** | ✅ | ❌ | ✅ |
| **Email Bindings** | ✅ | ✅ | ✅ |
| **Hyperdrive** | ✅[^2] | ❌ | ✅ |
| **Images** | ✅ | ✅ [**Recommended**](/workers/development-testing/#images) | ✅ |
| **KV** | ✅ | ✅ | ✅ |
| **mTLS** | ❌ | ✅ [**Recommended**](/workers/development-testing/#mtls) | ✅ |
| **Queues** | ✅ | ✅ | ❌ |
| **R2** | ✅ | ✅ | ✅ |
| **Rate Limiting** | ✅ | ❌ | ✅ |
| **Service Bindings (multiple Workers)** | ✅ | ✅ | ✅ |
| **Vectorize** | ✅[^3] | ✅ [**Recommended**](/workers/development-testing/#vectorize) | ✅ |
| **Workflows** | ✅ | ✅ | ❌ |

[^1]: Using Workers AI always accesses your Cloudflare account in order to run AI models and will incur usage charges, even in local development.

Expand All @@ -34,12 +38,6 @@

[^4]: Analytics Engine is supported in local development with Wrangler but is not currently supported in the Vite plugin.

> **Tip:** If you need to use any bindings marked with ❌ under local development, run:
>
> ```bash
> wrangler dev --remote
> ```
>
> This command allows you to develop against remote resources and data stored on Cloudflare's network.
> **Tip:** If you have a binding with no local dev support, try [hybrid development](/workers/development-testing/#hybrid-development) to connect to the remote resource while keeping your Worker code running locally.

---
---
Loading