Start the local dev server
local dev
// what it does
Boots your Worker in the local workerd runtime with hot reload on http://localhost:8787. In v4 this runs fully local by default — KV, R2, D1, and Durable Objects are simulated on disk, so nothing hits production. This is your everyday edit-run loop.
// shell
$ wrangler dev$ wrangler dev --port 8788 --var API_ENV:local// gotcha
Local KV/D1/R2 read from .wrangler/state, never production — so they stay empty until you seed them locally. Set a compatibility_date in config; without one wrangler warns and defaults to today's date, which can shift runtime behavior.