Coding activity
API Restaurant
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
Materials and setup
- order slips
- menu cards
- play food
- pencil
How this changes by age
Pre-K (ages 3–4)
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
Steps
- Set up 3 stations: Customer (at a table), Waiter (walking around), Kitchen (behind a counter).
- Customer tells the waiter: 'I would like a sandwich, please.' Waiter writes it on a slip.
- Waiter brings the slip to the kitchen. Kitchen 'makes' the sandwich (pretend or real).
- Kitchen gives sandwich to the waiter. Waiter delivers it to the customer.
- Discuss: 'The waiter is like a messenger. The customer never goes into the kitchen! Computers send messages the same way.'
- Tell a grown-up one thing that surprised you.
Learning objectives
- Understand the role of a messenger between a requester and a provider
- Follow the request-response pattern through role play
- Connect the restaurant model to how computers communicate
Kindergarten (ages 5–6)
Build a restaurant ordering system! Write orders on slips (requests), send them to the kitchen (server), and get food back (responses). Learn what happens when the kitchen is out of an item!
Steps
- Create a menu with 6 items and pictures. Kitchen has a limited supply of each item.
- Customer fills out an order slip: item name, quantity, table number. This is the REQUEST.
- Waiter delivers the slip. Kitchen checks if the item is available.
- If available: kitchen prepares and sends it back with the waiter. RESPONSE: 'Here is your pizza!'
- If not available: kitchen sends back an error slip. RESPONSE: 'Sorry, we are out of pizza. Error 404!'
- Process 5 orders. Some succeed, some fail. Discuss: 'Computers get error messages too, like when a website cannot be found!'
- Tell a grown-up one thing that surprised you.
Learning objectives
- Write structured requests with specific required information
- Understand that responses can be success (data returned) or error (item not found)
- Process multiple requests and handle both successful and failed responses
Early elementary (ages 6–8)
Design a fuller API system. Create endpoints, handle multiple requests, add simple authentication, and manage error codes. Your restaurant runs like a web server and a busy small business.
Steps
- Design your API endpoints: /order (place an order), /menu (see available items), /status (check if order is ready), /cancel (cancel an order).
- Create request slips for each endpoint with required fields. /order needs: item, quantity, customer name. /status needs: order number.
- Think like a business owner too: what information helps the restaurant serve customers correctly and keep orders organized?
- Add simple authentication: customers need an order number or special code on their slip to check or cancel an order.
- Run the restaurant with 3 customers ordering at once. Kitchen processes requests in order (queue). Track order numbers.
- Error codes: 200 = order complete, 201 = order received, 404 = item not found, 429 = too many orders (kitchen overwhelmed), 500 = kitchen fire (server error).
- Discuss: 'Real websites work this way! Your browser sends requests and gets responses with status codes.'
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Design multiple API endpoints with defined request and response formats
- Implement simple authentication and access control in the request system
- Use standard error codes to communicate different types of failures
Upper elementary (ages 8–10)
Build a complete client-server model on paper. Design API endpoints, handle multiple requests, and understand how apps ask servers for data.
Steps
- Design a REST API for a library: GET /books (list all), GET /books/123 (one book), POST /books (add new), PUT /books/123 (update), DELETE /books/123 (remove). Write the request and response format for each.
- Implement on paper: create 10 book records. Process 8 requests of different types. Show the response for each (including the data returned).
- Concurrent requests: 3 people request different books at the same time. Design a queue system. What happens if two people try to update the same book?
- Real-world connection: when you open an app, your phone often sends several requests to a server. Explain why an app might ask for data in small pieces instead of one giant message.
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Design RESTful API endpoints using standard HTTP methods
- Explain simple ways systems manage server load
- Analyze concurrent request scenarios and identify potential conflicts
Safety and evidence note
Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.
Related coding activities
AI Explorers
Train a pretend 'robot brain'! Show it 5 cat pictures and 5 dog pictures, then test if it can guess a new one.
Algorithm Art
Follow step-by-step drawing instructions to create a picture. The instructions are your algorithm! Each step adds one shape or line.
App Design Workshop
Design your dream app! Draw what you'd see on a phone screen. What would your app do? What buttons would it have?
Automation Station
Act out your morning routine — wake up, brush teeth, get dressed, eat — and notice how you do the same steps EVERY day. That's a loop, just like computers use!