Wrangler: deploy a Worker from your project folder
Wrangler
What it is
Wrangler is Cloudflare’s command-line tool for Workers. You run it in a project folder that has a wrangler.toml and a script (for this tutor, worker.js). From that folder, commands such as wrangler deploy upload the script and apply the bindings listed in the config.
The wrangler.toml file is the project’s deploy map. It names the Worker, points at the main script, sets a compatibility date, and lists routes or custom domains. Wrangler reads that file so a deploy is repeatable: same folder, same command, same Worker — not a one-off paste in the dashboard.
You can still edit a Worker in the Cloudflare dashboard. Wrangler is the path when the source lives in a folder you keep, edit, and redeploy. For day-to-day apps on kosan.xyz, that is usually how a lesson, a small tool, or a harness gets updated.
Why it matters
Dashboard paste is fine for a quick trial. It is a poor habit for anything you will change again. Without a project folder, the next edit is guesswork: which script is live, which routes belong to which Worker, and whether you are about to overwrite the wrong one.
Wrangler keeps the Worker name and its hostname triggers in one place. When name = "cloudflare-tutor" and the [[routes]] entries only mention cloudflare.kosan.xyz, a deploy updates that Worker and those triggers. It does not redeploy ainews, aiweekly, or any other Worker in the account.
For a GP stack with many small Workers, that scope matters. One wrong name in wrangler.toml, or deploying from the wrong folder, is how traffic moves. Reading the config before you deploy is part of the job.
On your account
This tutor’s project lives in a folder with worker.js and wrangler.toml. The config sets name = "cloudflare-tutor", account_id for your Cloudflare account, main = "worker.js", and only two [[routes]] entries: cloudflare.kosan.xyz/* and the bare hostname cloudflare.kosan.xyz with custom_domain = true, both in zone kosan.xyz.
When a new lesson is added to the LESSONS array in worker.js, the publish step is: open that project folder, then run wrangler deploy (often via npx wrangler deploy). That republishes cloudflare-tutor on cloudflare.kosan.xyz. It does not touch Single Redirect rules, DNS rows for other names, or Workers such as ainews or aiweekly.
The same pattern applies to other kosan.xyz or drkotha.com Workers you keep in folders: each project’s wrangler.toml should name one Worker and bind only that Worker’s hostname. Deploy from the folder that matches the app you mean to update.
Do this yourself
These stay in the dashboard, on your side. This site does not change DNS, routes, or other Workers.
- On your machine, open the cloudflare-tutor project folder (or any local copy of it). Open wrangler.toml and confirm name is cloudflare-tutor and that the [[routes]] patterns mention only cloudflare.kosan.xyz in the kosan.xyz zone. Read only. Do not change the file, and do not run a deploy from this exercise.
- Optional check only: in a terminal, from that same folder, run npx wrangler whoami and confirm you are logged into the expected Cloudflare account — or open the dashboard, Workers & Pages → cloudflare-tutor → Deployments, and note the latest deploy time without editing anything. Optional throwaway only: create a new Worker via CLI named only tutor-wrangler-lesson, do not attach any domain or route, then delete that same Worker. Never point CLI deploys at ainews, aiweekly, or other live apps.