# Cloudflare Workers

> Run small programs on Cloudflare’s network to handle website requests, such as looking up where a short link should send a visitor.

Web page: https://buildladder.com/tools/cloudflare-workers

Consider a printed poster with a short link to this week’s event. A Worker can receive a visit to that link and send the visitor to the current event page. The poster can stay in place even when next week’s destination changes.

Try a Worker with one short path and one destination. Open the link in a browser, then change the destination and try again. You’ve given the site behavior without managing a server yourself.

- Made by: Cloudflare
- Official site: https://developers.cloudflare.com/workers/
- Cost: Free plan with 100,000 program requests a day. Requests for plain files, like pages and images, are free and unlimited. Workers Paid is $5 a month minimum, checked on 2026-11-09.
- What you need first: A Cloudflare account.
- Who it helps: When your site might get lots of visitors on a small budget, or you also buy your domain from Cloudflare.
- When to skip it: If this is your first site, because Cloudflare’s setup uses more technical words than Vercel’s or Netlify’s.
- Updated: 2026-11-10

## Put your site online with Cloudflare

Put your website online with Cloudflare Workers, straight from GitHub or GitLab. Each change you push then goes online by itself.

What you’ll end up with: Your site is online at a workers.dev address. It updates each time you push to GitHub or GitLab, and can use your own domain.

### You’ll need

- A website that works on your computer.
- Your code saved on GitHub or GitLab.
- PLAN.md from the “Plan your idea” guide.
- Your .env file, if your product uses keys.
- A phone to check the live site.
- A domain you bought, only if you want your own address. Domains, under Concepts, explains whether you need one.
- GitHub or GitLab account (https://github.com): The free plan is enough
- Cloudflare account (https://dash.cloudflare.com): Free to create

### Your part

- Create the Cloudflare account and connect GitHub or GitLab.
- Type your secret keys into Cloudflare’s settings.
- Change your domain’s nameservers where you bought it, if that wasn’t Cloudflare.

### Step 1 of 6: Check your product before you put it online

Read PLAN.md in this folder. I want to put this product online with Cloudflare Workers. My code is already saved on GitHub or GitLab, and Cloudflare Workers will put it online from there.

If this folder isn’t connected to a GitHub or GitLab repository yet, stop and tell me. I’ll save it there first.

Check my product:
- Make sure .env and any other files with keys or passwords are listed in .gitignore, so Git never uploads them.
- Look through my saved Git history for keys or passwords saved earlier. If you find any, stop and explain. Those keys must be replaced with new ones first.
- Check that the product still builds and runs on my computer.
- Check Cloudflare Workers’s current official docs for anything my framework needs to work there. Tell me before you change anything, and keep everything that already works.

If you change anything, ask me before you save a commit and push it.

Finally, list every environment variable my product needs. Show only the names, never the values. For each one, say whether it’s public (safe to show in the browser) or secret, and what it’s for. Also say whether each one is needed while the site builds, or only while it runs.

It worked when: You have a list of the setting names your product needs, and your saved code holds no keys.

Before we move on, check with me:
- Open your repository on GitHub or GitLab. Is .env missing from the file list?

Keep for later: You need the list of setting names in “Add your secret settings”.

If something goes wrong:
- Your AI tool says the folder isn’t on GitHub or GitLab yet. Save your code to GitHub or GitLab first. Their tool pages have the steps. Then do this step again.
- Your AI tool found a key in your saved history. Make a new key in that service’s dashboard and delete the old one. Then ask your AI tool to help remove the old key from the history.

### Step 2 of 6: Get it ready for Cloudflare

I want to host this product on Cloudflare Workers. Cloudflare will build it from my GitHub or GitLab repository each time I push.

Check Cloudflare’s current official docs for my framework, then get my product ready:
- Add the Wrangler configuration file Cloudflare needs, if there isn’t one yet. Wrangler is Cloudflare’s publishing tool.
- If my framework needs a Cloudflare adapter, tell me what it is and ask before installing it.
- Set keep_vars to true in that file, so settings I add in Cloudflare’s dashboard aren’t removed on the next deploy.
- Never put secret keys in that file. I’ll add them in Cloudflare’s dashboard myself.
- Make sure the product still runs on my computer the way it did before.

Don’t run a deploy command, and don’t sign me in to anything.

Ask me before you save a commit and push it.

It worked when: Your repository has a Wrangler settings file, and your site still works on your computer.

Before we move on, check with me:
- Open your repository on GitHub or GitLab. Is there a file whose name starts with wrangler?

If something goes wrong:
- It says your framework isn’t supported. Ask: “Which Cloudflare framework guide fits my product? Explain the choices in plain words.” If none fit, Vercel or Netlify may be simpler.

### Step 3 of 6: Create your account and connect your repository

This step is mine to do. Walk me through it, one action at a time:
- Go to dash.cloudflare.com and create an account.
- In the dashboard, go to Workers & Pages and select Create application.
- Choose GitHub or GitLab, whichever holds your code. If asked, sign in there and let Cloudflare see your repository. On GitLab, Cloudflare’s access shows up under the name Cloudflare Pages.
- Pick your repository from the list.
- Check the build command. Ask your AI tool which one your product uses, often npm run build. Leave the deploy command as it is.
- Select Save and Deploy.

It worked when: Cloudflare starts building your site, and you see a page for your new Worker.

If something goes wrong:
- The first build failed. That’s fine if your product needs secret settings. “Add your secret settings” adds them and starts a new build.
- Cloudflare opened a pull request on GitHub. That means it couldn’t find your Wrangler file. Ask your AI tool to explain the pull request before you accept it.
- Your repository isn’t in the list. Cloudflare may only see some of your repositories. On GitHub, open Settings, then Applications. Select Configure beside Cloudflare Workers and Pages, and add this repository under Repository access.

### Step 4 of 6: Add your secret settings

This step is mine to do. Walk me through it, one action at a time:
- If your list of setting names was empty, skip this step.
- Open your Worker, then Settings. Under Variables and Secrets, select Add.
- For each setting used while the site runs, type the name exactly and copy the value from your .env file.
- Pick Secret as the Type for secret keys. Then select Deploy.
- For settings used while building, open your Worker’s build settings. Add them under Build variables and secrets.
- Start a new build so it uses them. You can retry the last build, or push your next change.

It worked when: Every name from your list is added in the right place, and a new build is running.

Before we move on, check with me:
- Count the names in both places. Does the total match your list?
- Is every secret key set to the Secret type?

If something goes wrong:
- You don’t have a value for one of the names. Ask your AI tool where that value comes from. It’s usually in another service’s dashboard, like your payments or database account.
- A setting you added has disappeared. Ask your AI tool to check that keep_vars is true in your Wrangler file. Then add the setting again.

### Step 5 of 6: Open your live site on your phone

This step is mine to do. Walk me through it, one action at a time:
- Wait for the build to finish.
- Find your site’s address on your Worker’s page. It ends in workers.dev.
- Open that address on your phone.
- Try the main thing your site does, from start to finish.
- Write the address into PLAN.md so you can find it later.

It worked when: Your site opens on your phone at an address ending in workers.dev.

Before we move on, check with me:
- Does the main feature work on your phone too?

If something goes wrong:
- The build failed. On your Worker’s Deployments tab, open View build history. Copy the build log into your AI tool and ask: “What does this mean, and how do I fix it?”
- You see Error 1102. Your site needed more computer time per visit than the free plan allows. Ask your AI tool if pages can be made ahead of time.
- You see Error 1027. Today’s free requests are used up. The count resets at midnight UTC. The Workers Paid plan removes the daily limit.

### Step 6 of 6: Connect your own domain

This step is optional. Ask me whether I want it, and skip it if I don’t.

This step is mine to do. Walk me through it, one action at a time:
- Bought elsewhere: in the Cloudflare dashboard, go to Domains and select Onboard a domain. Type your domain and pick the Free plan.
- Bought elsewhere: Cloudflare scans your DNS records. Compare its list with the records at your domain seller and add any that are missing. Include the MX records your email needs.
- Bought elsewhere: at your domain seller, look for DNSSEC. If it is on, turn it off before you change nameservers.
- Bought elsewhere: Cloudflare gives you two nameservers. Replace the old ones at your domain seller with these two, then wait until Cloudflare shows Active.
- Open your Worker, then Settings, then Domains & Routes. Select Add, then Custom Domain.
- Type your domain and select Add Custom Domain. Do it again for the www version.
- Update the address in PLAN.md to your new domain.

It worked when: Your site opens at your own domain, with a lock icon in the address bar.

Before we move on, check with me:
- Try it with and without www. Do both work?

If something goes wrong:
- DNSSEC was on at your domain seller. Turn it off there, or remove its old DS record, and wait for that record’s TTL to expire before you change nameservers. To turn DNSSEC on again later, open your domain in Cloudflare, then DNS, then Settings, and click Enable DNSSEC. Add the new DS values it shows at your domain seller. Never restore the old values.
- Email stopped arriving at your domain. An email record didn’t come across. Ask your email service which records you need. Add them under your domain’s DNS records in Cloudflare.
- Cloudflare still says the domain is pending. Check that the nameservers at your domain seller match Cloudflare’s two exactly. Remove any old ones.
- Only one of yourname.com and www.yourname.com works. Add the missing one as a second Custom Domain on your Worker.

Compare Cloudflare Workers with the other options: https://buildladder.com/concepts/hosting.md
