Wrangler and Miniflare — Build Locally, Ship Globally
Hoplink is about to grow a new feature: letting people attach files to short links. Before touching storage, you need a comfortable loop for writing, running and deploying code. Editing in the dashboard works for a demo, but real projects live in a folder, in Git, driven from the terminal.
The rule
Create, dev, deploy — local first, real network last.
Wrangler is Cloudflare's command-line tool. Four commands carry most of the load:
npm create cloudflare@latest hoplink # scaffold a new project
npx wrangler dev # run it on your machine
npx wrangler deploy # publish to the whole network
npx wrangler tail # stream live logs from production- Create. The scaffolding tool writes
wrangler.jsonc, asrc/entry file andpackage.json, and can set up TypeScript and a framework such as Hono. - Dev.
wrangler devserves your Worker athttp://localhost:8787. It runs on Miniflare, a local simulator built onworkerd, the same open-source runtime that powers production Workers. Your KV, R2, D1, Durable Objects and queues are simulated too, stored under.wrangler/statein the project folder. Nothing you do locally touches real data. - Deploy.
wrangler deploybundles your code, uploads it with the bindings from your config, and it is live worldwide within seconds. - Observe.
wrangler tailshowsconsole.logoutput and errors from real traffic;wrangler devalso offers a DevTools inspector for breakpoints.
Resources are created from the same tool: wrangler kv namespace create LINKS, wrangler r2 bucket create hop-files, wrangler d1 create hop-db. Each command prints the config snippet to paste into wrangler.jsonc.
In a team, wrangler deploy usually runs from CI rather than a laptop: a pipeline installs dependencies, runs tests, and deploys with an API token stored as a CI secret.
The shortcut
For every change, climb the same ladder and stop at the first rung that proves it: local dev → preview → production. Most bugs die on the first rung, where mistakes are free.
Scaffold the resource
wrangler r2 bucket create hop-files, then add the printedr2_bucketsentry towrangler.jsonc.
Trap: expecting local data to appear in production (or the reverse). Local and remote are separate worlds; commands that act on data usually take --local or --remote so you can choose deliberately.
Drills
Answer fast — trust the rule.
Which command runs Hoplink on your own machine with simulated bindings?
What is Miniflare?
A link created while running wrangler dev does not appear on the deployed site. Why?
You want to see errors from real production traffic as they happen. What do you run?
Remember
- Create, dev, deploy — local first, real network last.
- Shortcut: climb local → preview → production and stop at the first rung that proves the change.
- Trap: mixing up local simulated data with remote data.
