Lab GuideWhat's next
14:30 17:00

LAB GUIDE / SECTION 09

What's next

What you built#

YOUR WORKSHOP, CONNECTEDOne push. One Student Worker.
One push. One Student Worker. Your laptopWrite your code GitHubYour repo WorkersBuilds git push build deploy Your Student Worker Cloudflare’s network · your account /Student Page /api/cardCard /api/chatDroid SWAPIStar Wars API 2 fetches+ cache The HubCalls both API routes calls THE DROID USES YOUR MISSION 2getCharacter()Reused by your DroidSWAPI + cache YOUR OWN ACCOUNTWorkers AIenv.AI bindingOn your Student Worker One push. One Student Worker. Your laptopWrite your code git push GitHubYour repo build WorkersBuilds deploy Your Student WorkerCloudflare’s network YOUR ACCOUNT /Student Page SWAPIStar Wars API 2 fetches+ cache /api/cardCard The HubCalls both API routes calls calls /api/chatDroid THE DROID USES YOUR MISSION 2getCharacter()Reused by your DroidSWAPI + cache YOUR OWN ACCOUNTWorkers AIenv.AI bindingOn your Student Worker
Three routes. One Student Worker. Your own Cloudflare account.Your laptop uses git push to send code to GitHub. Workers Builds deploys it to your Student Worker on Cloudflare’s network, in your own account. The / route serves your Student Page, which makes two fetches to SWAPI with caching to fill in your Character’s ID card. The Hub calls /api/card for your Card and /api/chat for your Droid. The Droid reuses your getCharacter function from Mission 2, and calls Workers AI through env.AI on your own Cloudflare account.
ConceptYou used it for
WorkersYour Student Page, your API, your Droid
Wranglerdev, tail
Workers Buildsgit push → live in ~30 s
varsConfig vs code: name, tagline, emoji, Character
fetch + cacheTwo chained SWAPI calls with a fallback, cached at the edge
Workers AI + bindingsenv.AI on your own account for your Droid
Observabilitywrangler tail, the logs in the dashboard
Coding Agent + Cloudflare SkillsBuilding and fixing your Droid from a prompt, then reviewing it before it shipped

Behind the scenes#

The Hub is also just a Worker, on the teacher's account. It uses a Durable Object: one object that coordinates Registration, Rounds and the live Directory. Because there's only one of it, it handles one thing at a time, so two students registering at the same moment can't step on each other. Its data sits in SQLite, right next to the code.

During this part we'll open the Hub's database live in the Cloudflare dashboard. You'll see the students and answers tables fill up as you registered and as the Rounds ran. Your Card is one of those rows.

After today#

  • Your Student Page and your Droid keep running on your free account. Share the link!
  • Your Droid runs on your own Workers AI and fetches SWAPI by itself, so it keeps answering after today. The Hub freezes the Directory and stops running Rounds, but your Worker doesn't care.
  • The free plan includes 100,000 requests/day and 10,000 Workers AI "Neurons"/day, which is plenty for a personal project.
  • Your /api/chat is open: anyone who finds your URL can call it and use your free Workers AI quota. That's fine for a class. Ideas 1 and 2 below fix it.

What next? Bonus ideas#

IdeaYou'll learn
Protect /api/chat with a rate limitRate Limiting binding, securing an API
Require a key on /api/chat and keep it as a secret (the sidebar in Mission 2 shows how)Secrets, locally and in production
Ask your agent for an "Ask my Droid" box or a films panel on your page, if you haven't yetFull-stack Workers: page and API in one
Add a second route, for example a random planet or starship from SWAPIRouting, more fetch and caching
Your own domain instead of *.workers.devCustom domains
Connect your agent to your account with the Cloudflare MCP server (Agent setup)Agents that read logs, check builds and manage resources for you
Remember the questions your Droid gotStorage bindings (KV / D1). Covered in a separate presentation!

Docs: https://developers.cloudflare.com/workers/

That’s the workshop. Your Worker keeps going.

Your project

Pick your Droid Name first. Add the rest when you know it; every field is optional. These details stay in this browser and are never sent anywhere.

A nickname, not your full name. Used for your Student Worker and repo. Lowercase letters, numbers and hyphens; up to 40 characters.

The workers.dev subdomain you choose at signup. Same naming rules as your Droid Name.

Add this later, or paste a GitHub repo URL to fill your username and Droid Name.

My URL is different

Optional. Use your public https://…workers.dev URL. Paths and trailing slashes are removed. Leave blank to use your Droid Name and subdomain.

LIVE PREVIEW

Your droid will live at https://<your-droid-name>.<your-subdomain>.workers.dev

Your repo: github.com/<your-github-user>/<your-droid-name>