Skip to content

Local Development

alchemy dev gives you a fast local development loop without sacrificing access to real cloud services. Infrastructure is deployed to the cloud while your code runs locally with hot reloading.

Terminal window
alchemy dev
 Bucket (Cloudflare.R2Bucket) created
 DB (Cloudflare.D1Database) created
 Worker (Cloudflare.Worker) created (local → workerd)
  • http://localhost:1337

Watching for changes ...

Three things happen:

  1. Infrastructure deploys to the cloud — R2 Buckets, D1 Databases, KV Namespaces are created on the real provider. No emulation, no fidelity gaps.
  2. Workers run locally in workerd — your code executes in workerd, the same runtime used in production. A proxy routes requests between the cloud and your local process.
  3. File changes hot reload — edit your code and the Worker rebuilds instantly.
Watching for changes ...

 src/worker.ts changed
  • Rebuilding worker ...
 Worker reloaded in 42ms

 src/api.ts changed
  • Rebuilding worker ...
 Worker reloaded in 38ms
  • Code changes take effect in milliseconds, not minutes
  • Cloud resources stay deployed across reloads — only your application code is rebuilt
  • Edit, save, refresh

Full local emulation (Miniflare, LocalStack) replicates cloud APIs on your machine. This leads to fidelity gaps, missing features, and false confidence — tests pass locally but fail in production.

Alchemy avoids this. Your R2 Bucket is a real R2 Bucket. Your D1 Database is a real D1 Database. The only thing running locally is your application code.

Because Workers run locally in workerd, you can attach a debugger:

  • Set breakpoints in your IDE
  • Inspect variables and call stacks
  • Profile performance

No more console.log debugging against deployed Workers.

Resources adapt their behavior in dev mode:

  • Cloudflare Workers — run locally in workerd with a cloud proxy instead of deploying to the edge
  • Vite dev servers — integrate with Alchemy’s dev server for frontend hot reloading alongside your backend
  • Databases — connect to real cloud instances, eliminating schema drift between dev and prod

Each resource’s provider checks ALCHEMY_PHASE (set to dev) and adjusts accordingly.

export default Cloudflare.Worker("Worker", {
main: import.meta.path,
dev: {
port: 3000,
},
// ...
});
alchemy devalchemy deploy
InfrastructureDeployed to cloudDeployed to cloud
Application codeRuns locally in workerdDeployed to cloud
File watchingHot reload on changeManual redeploy
DebuggingAttach local debuggerTail logs
SpeedMillisecondsSeconds to minutes
FidelityReal cloud resourcesReal cloud resources