ISCTE / CLOUDFLARE WORKSHOP
Deploy to Region: Earth
Today you'll build one Cloudflare Worker and deploy it to Region: Earth: not one data centre, but Cloudflare's whole network at once. By 17:00 it will be:
- A Student Page: a Droid ID card with your name, a Star Wars Character you pick, and the facts of their homeworld. The page changes its look to match that planet: desert, ice, forest, lava...
- A Star Wars Droid: it plays your Character, in a tone you write, and answers questions live in front of the class. You'll build it by directing a Coding Agent.
You keep all of it: your Cloudflare account, your GitHub repo, and your live URL. And there are no API keys to sign up for today.
The Hub: the whole class, connected#
Your Worker won't live alone. The teacher runs one more Worker, the Hub, at https://arena.cf2026iscte.nobledemos.com, and it's on the projector all session. Every student Worker plugs into it:
- You join the class Directory. Once your page is live, you register it with the Hub. The Hub calls your Worker, checks that it answers correctly, and your Card appears on the projector next to everyone else's (in about 45 minutes). Every Card comes with a Pixel Droid, a little 16×16 robot drawn from your Worker's URL. It's the same droid on your own page.
- The Hub broadcasts questions. In Phase 2 the teacher presses Go, and the Hub sends the same question to every Droid in the room, six at a time. Each card on the projector lights up with whether your Droid answered and how fast. Then you get a few minutes to fix your code, push, and see your card turn green on the next Round.
- Everyone reads everyone's answers. After each Round, every Droid's answer is published on the Hub. The teacher puts the funniest ones on the big screen. There are no winners, just 40 Star Wars Characters in 40 different tones answering the same question.
That's a real production setup: one service calling 40 independently deployed services, owned by 40 different people, with timeouts, errors, logs and redeploys while it's live.
What's a Worker?#
A Worker is a small piece of JavaScript that runs on Cloudflare's network. There's no server to manage: you write a fetch function that gets a request and returns a response, and Cloudflare runs it.
Region: Earth#
On most clouds, the first question is "which region?": us-east-1, eu-west-1, and so on. Pick Virginia, and a visitor in Lisbon waits for every request to cross the Atlantic and back.
Workers have no region dropdown. One deploy puts your code in more than 300 cities worldwide, and each request runs in the data centre closest to whoever sent it. A visitor in Lisbon is served from Lisbon, and a visitor in Tokyo from Tokyo. Same code, same deploy, no extra work.
export default {
async fetch(request, env) {
return new Response(`Hello from Region: Earth! Served from ${request.cf?.colo}`);
},
};request.cf.colo is the code of the data centre that ran your code (for example LIS for Lisbon). You'll see it for yourself once you deploy.
That's a complete Worker. Everything today builds on these 5 lines.
How today works#
| Phase 1 — your Student Page | Phase 2 — your Droid | |
|---|---|---|
| You learn | Deploying, config, calling an API with chained fetch calls and caching, all by hand | Workers AI, directing a Coding Agent, debugging in production |
| You finish with | A live Student Page + your Card on the projector | A Droid that answers in character |
- Every step ends with a Check. If you pass it, move on.
- Stuck for more than 5 minutes? Open "Show solution", paste it, and keep going. That's allowed and expected.
- Moving fast? Look for Stretch boxes.