Build a Lunch Order Book
A one-person kitchen cooks 30 lunch boxes a day and keeps saying yes to more orders than it can cook. You will build the order book that says no for her when the day is full or the cutoff has passed, and that hands her a sheet of what to cook and where to deliver.
The brief
The client
I cook lunch boxes in my own kitchen in Amsterdam for two office buildings nearby, and I deliver them myself on a bike. I can cook 30 boxes a day from three dishes, and I take orders as chat messages that I count in a notes app.
Last Tuesday I said yes to 41 people before I did the sums. I spent the morning writing sorry to 11 of them, and two had already told their team that lunch was sorted. I do not need an app store listing. I need one place where I enter tomorrow's dishes and portions, people order against it, and it says no when the day is full or the order is too late. I stop taking orders for a day at 09:30 that morning, because I start cooking soon after.
The problem
Every yes in a chat is a promise to cook and carry a box, and she makes it from a running count in her head. A miscount means she cooks more than her kitchen allows, or she breaks a promise to someone who planned their lunch around it. Eleven apologies cost her a morning of cooking time, and each broken promise costs a customer she cannot easily win back.
She also cannot tell later what she charged a person, because she edits her prices in the same notes app. At the end of the day she adds up the cash by hand from scrolling chats.
The client's name and figures are invented for this brief; the rules and the failures are ones that real businesses of this kind work with.
The spec
Requirements
- Enter a day's menu: the dishes, a price for each dish, the portions she will cook of each, and the cutoff time after which no order is taken for that date.
- Change the price of a dish.
- Show a customer a day's menu with the portions still left for each dish.
- Place an order for a date with one or more lines, and accept it only if every line fits in the portions left and the cutoff has not passed. Otherwise refuse it with a reason the customer can read, and change nothing.
- Keep the price each customer was charged on their own order, so a later price change does not alter an earlier order.
- Cancel a placed order before the cutoff and give its portions back. Refuse a cancel after the cutoff.
- Give the client a kitchen sheet for a date: how many of each dish to cook, and each order with name, phone number, delivery spot and the total to collect.
- Mark an order delivered, and show the cash collected on a date, which is the sum of the delivered orders only.
- Let the person or the request supply the current time for an order or a cancel, so the cutoff can be tried at 09:29 and 09:31 without waiting. This exists for testing.
Deliverables
- A running program with your own choice of interface: a web page, an API that other programs call by sending requests, or a command-line tool. It keeps its data when it is closed and started again.
- A README that takes a reviewer from an empty data store to a finished day in 10 minutes, with the steps to enter a menu, place orders and read the kitchen sheet.
- A document of at least 8 example days, each with a starting menu, one order or cancel and the expected answer.
- An automated test set, code that drives the program and checks its answers against the expected ones, that runs every example day with one command and shows which examples pass.
- A script or written walk-through of a whole day with the cash collected worked out by hand beforehand.
Out of scope
- Accounts and logins. A name and a phone number on the order are enough for 30 boxes a day. Do not put this tool on the internet, because anyone who can reach it can read every customer's phone number and cancel any order.
- Card payments. Customers pay cash on delivery, so no order has a paid state.
- Two people ordering the last portion at the same moment. One order at a time is enough here.
- More than one kitchen, or menus owned by several restaurants. One kitchen keeps the rule checkable.
- Couriers, dispatch and live tracking. The client is the courier.
- Notifications. She texts the customer herself.
- Delivery fees, tax, tips, discounts and promotions. Each is a pricing rule of its own, and this project is about the portions rule.
- Waiting lists for a sold-out day. A waiting list is a second rule on top of the first.
- Repeating weekly menus and opening hours. A menu is typed in for each date.
- Allergen filtering. It is a legal topic in its own right.
Architectural constraints
- Amounts are exact to the cent: people see 9.50, and no sum of prices is ever off by a cent.
- A cutoff is 09:30 Amsterdam time (Europe/Amsterdam), whatever the time zone of the machine running the program.
- The person or the request can supply the current time for an order or a cancel, for testing. The real time is used when none is supplied.
- A refused order changes nothing, including the lines that would have fit.
- Saved data survives closing and restarting the program.
- An order keeps the price it was charged, whatever the price list says later.
- A quantity is a whole number of 1 or more, and an order has at least one line.
Prerequisites
You can write a small program in a language of your choice and have saved data to a database or a file once. You do not need to know how an ordering system works or any particular framework. You do not need to know how a home kitchen sells lunch boxes; the first Phase explains the business and the words the brief uses. Having written one automated test helps.
Free to start. An account is what keeps track of the checkpoints you finish.
Take orders that respect the day
Produces orders that are accepted or refused by the day's rule, priced from the menu and cancellable, with the example days from Phase 1 running as automated tests. The kitchen sheet and delivery wait for the next Phase.
Acceptance criteria
A customer places an order for 4 Nov 2026 with the name Mila, the phone number 0612345678, the delivery spot "Building B, 3rd floor" and one line: 2 of dish A, which costs 9.50. The answer shows an order in the state placed, with one line of quantity 2 at 9.50 per portion and a total of 19.00.
Asking for the menu of 4 Nov 2026 now shows dish A with 8 left and the other dishes unchanged at 10. A second order of 3 of dish A brings dish A to 5 left. After the program is closed and started again, both orders are still there and dish A still shows 5 left. This Checkpoint does not check the cutoff or the portion limit yet, which the next Checkpoint adds.
Architectural guidance
An order the cook cannot find, or whose total differs from what the customer was told, is a broken promise. The day's portions have to drop by exactly what was ordered and stay dropped after a restart, or she cooks for orders that are gone or sells portions that are already promised. A total that is a cent off because of how the sum was done shows up on the delivery doorstep as an argument over change.
Acceptance criteria
A person or a request can supply the current time when placing an order, and the real clock is used when none is supplied. This exists for testing, so you can try 09:29 and 09:31 without waiting. Use a menu for 4 Nov 2026 with 10 portions each of dishes A, B and C and a cutoff of 09:30 Amsterdam time.
An order placed at 4 Nov 2026, 09:30:00 is accepted, and one placed at 09:30:01 is refused with a reason that names the 09:30 cutoff. An order placed on 3 Nov 2026 at 18:00 is accepted. An order of three lines (2 of A, 11 of B, 1 of C) is refused with a reason that names dish B, and afterwards the menu still shows 10, 10 and 10 and no order was saved. After an order of 10 of dish C is accepted, the menu shows 0 left for C and a following order of 1 of C is refused with a reason that names dish C. An order with 6 of A on one line and 5 of A on another is refused, because the two lines together ask for 11 of 10.
Each of these is refused with a reason that names the problem, and nothing is saved: an order for a date with no menu, an order with no lines, a line of quantity 0, -2 or 1.5, a dish that is not on that day's menu, and an order whose name, phone number or delivery spot is missing or only spaces.
Architectural guidance
A refused order that still takes part of its change leaves the day looking fuller than it is. Take an order of 2 of A, 11 of B and 1 of C on a day with 10 of each: if the 2 of A are gone after the refusal, the cook leaves two boxes uncooked and unsold, and nobody can say where they went. A cutoff that can only be tried by waiting for 09:30 is never tried at 09:29 and 09:31, so the first real test is a customer who ordered one second late and was told yes.
Acceptance criteria
Dish A costs 9.50. A customer places an order of 2 of dish A, and the order shows a line price of 9.50 and a total of 19.00. The client then changes the price of dish A to 10.50. Asking for the first order still shows 9.50 per portion and a total of 19.00, also after the program is closed and started again. A new order of 2 of dish A shows 10.50 per portion and a total of 21.00, and the menu now shows dish A at 10.50.
Changing a price to -1.00 is refused with a message, and the price of dish A and all existing orders stay as they were.
Architectural guidance
The client edits her prices whenever ingredients cost more. If an old order's price follows the price list, last week's total changes without anyone touching it, and her cash figure for a closed day moves by a euro. She cannot tell a customer what they were charged, and she cannot trust any day she has already closed.
Acceptance criteria
With a cutoff of 4 Nov 2026, 09:30 Amsterdam time and an order of 2 of dish A placed (dish A shows 8 left), cancelling that order at 09:00 on 4 Nov 2026 marks it cancelled and the menu shows dish A with 10 left. On a second placed order of 2 of dish A, cancelling at 09:30:00 exactly works the same way, as the order rule does. On a third placed order, cancelling at 09:30:01 is refused with a reason that names the cutoff, leaving that order placed and its portions still taken.
Cancelling an order that is already cancelled is refused with a reason, and dish A still shows 10 left, not 12. Cancelling an order that does not exist is refused with a reason. After a cancel, a new order for 10 of dish A is accepted, which shows that the portions were really given back.
Architectural guidance
A cancel that does not give the portions back leaves the day showing fewer portions than are really promised, so the cook turns away orders she could have cooked. A cancel that is accepted twice gives them back twice, and the day shows 12 portions on a day she can cook 10. She finds out when the 11th customer has paid for a box she cannot make. A cancel after the cutoff breaks the other half of her day: she has already started cooking.
Acceptance criteria
Every example day from the first Checkpoint runs as an automated test, and the README gives one command that runs all of them. The output lists each test with pass or fail, and all of them pass. Each test sets the clock it needs itself and starts from an empty data store, so running the whole set twice in a row passes both times.
Change the cutoff check so that an order at exactly the cutoff moment gets the opposite answer. Running the tests now fails at least one of them, and the failure names the example. Change it back and all of them pass again.
Architectural guidance
A rule that is checked only by hand gets re-checked only when someone remembers. A later change to the cutoff or the portions then breaks a case nobody retried, and the cook learns about it from a customer. A check that depends on the real time of day, or on what an earlier check left behind, passes on Tuesday and fails on Wednesday, and then nobody trusts it. The deliberate break in the criteria shows that the checks watch the edge that matters.
Architectural walkthrough
This Phase has to survive four failures: the order that half fits, a cancel that gives portions back twice, a price change that rewrites old orders, and a cutoff nobody tries at 09:29 and 09:31.
The Phase ends by turning the example days into automated checks, so the rule holds when the program changes.
Hand the cook a sheet and close the day
Produces the kitchen sheet, delivery, the cash collected figure and a run of a whole day from an empty store. No new rule about the day is added.
Acceptance criteria
Use dishes A (9.50), B (10.00) and C (11.00) for 4 Nov 2026 with these orders: order 1 has 2 of A, order 2 has 1 of A and 1 of B, order 3 has 3 of C, order 4 has 2 of B, and order 5 has 4 of A and is cancelled. The kitchen sheet for 4 Nov 2026 shows to cook: A 3, B 3, C 3. The cancelled order contributes nothing.
The sheet lists one entry for each of orders 1 to 4 with the name, the phone number, the delivery spot and the total to collect, which is 19.00, 19.50, 33.00 and 20.00. Order 5 does not appear. Cancelling order 4 and asking again shows B at 1 and no entry for order 4. A date with a menu and no orders shows every dish with 0 to cook and no entries. A date with no menu returns the plain no-menu answer.
Architectural guidance
The cook cooks from this sheet. If it shows a cancelled order, or misses one placed after she last printed it, she cooks the wrong number of boxes or carries one to the wrong building. A sheet that disagrees with the orders is worse than no sheet, because she trusts it and the mistake reaches a customer.
Acceptance criteria
Using the five orders from the kitchen sheet Checkpoint (totals of 1900, 1950, 3300 and 2000 cents for the four that count, and order 5 cancelled), marking order 1 delivered changes its state to delivered. Marking order 3 delivered as well makes the cash collected for 4 Nov 2026 equal 5200 cents, shown as 52.00. Placed orders and the cancelled order add nothing. A date with no delivered orders shows 0.00.
Marking the cancelled order 5 delivered is refused with a reason, and its state stays cancelled. Marking order 1 delivered a second time is refused with a reason. Cancelling the delivered order 1 is refused with a reason, and dish A's portions left do not change.
Architectural guidance
The cash figure has to match the money in her hand at the end of the day. If it counts orders that were cancelled or never delivered, she is short against the figure and cannot tell which customer did not pay. If a delivered order can still be cancelled, or delivered twice, the figure and the portions both stop meaning anything. A cent of drift in the sum shows as a shortfall she cannot explain.
Acceptance criteria
Starting from an empty data store, a script or a written walk-through enters a menu with 30 portions across 3 dishes (10 of each) and a cutoff of 09:30 Amsterdam time. It places 12 orders whose lines add up to all 30 portions, and the menu then shows 0 left for every dish. A 13th order of 1 portion is refused. One order of 2 of dish A is cancelled before the cutoff, and a new order of 2 of dish A is accepted afterwards, which brings the menu back to 0 left.
The script then produces the kitchen sheet, marks every order that is not cancelled as delivered, and prints the cash collected. That figure equals a total you added up by hand before running it, and the hand calculation is written down next to the script. The README gives the steps to run the whole day, and a reviewer reaches the printed figure within 10 minutes.
Architectural guidance
Small checks miss the mistakes that sit between the steps, such as an order that is accepted correctly but never reaches the kitchen sheet. A cash total copied from the program's own output repeats whatever mistake the program makes, so the figure has to be worked out by hand before the run. If the run depends on leftovers from an earlier day, a different answer on a different day says nothing about the code.
Architectural walkthrough
This Phase has to survive a kitchen sheet and a cash figure that disagree with the orders behind them.
The final Checkpoint runs a whole day from an empty start and compares the result with a total added up by hand first. If the program and the arithmetic disagree, one of them has a mistake, and finding which one is the point of the exercise.
Architectural walkthrough
The day answers for every order before it
Whether the kitchen can take 2 more portions of dish B depends on every order already placed for that date, on every cancel, and on the clock. A form that saves rows has no memory of any of that. This project turns on one rule: an order is accepted only if every line fits in the portions left and the cutoff has not passed, and a refused order changes nothing at all.
The order that half fits
Take an order of 2 of dish A, 11 of dish B and 1 of dish C on a day with 10 portions of each. B cannot be met, so the order is refused. If the 2 portions of A are still gone afterwards, dish A shows 8 left and nobody owns the missing 2. The cook sees a fuller day than she has and leaves two boxes uncooked and unsold. Two people ordering the last portion at the same moment is a separate problem, and this project leaves it out on purpose.
The clock and the zone
A cutoff of 09:30 means nothing until it says where. A program running on a server in another time zone cuts off an hour early or late, and nobody notices until a customer complains. The client's cutoff is 09:30 in Amsterdam, wherever the program runs.
The cutoff is also hard to check. If the only way to see what happens at 09:29 and 09:31 is to wait for the real time to pass, it is never checked, and the first real test is a customer who ordered one second late. The person or the request can supply the current time, for testing.
The price she charged
Her price list changes, and what she charged must stay what she charged. If an old order follows today's price, raising a price by 50 cents rewrites last week's orders and the cash collected figure moves with it.
Where it shows if you cut a corner
Three symptoms show a cut corner. A day that shows fewer portions than were sold means a refused order kept part of its change. A cutoff check that passes on your laptop and fails on a friend's means the time zone came from the machine. A cash figure that moves after a price change means an old order followed the price list. The whole-day run in the last Checkpoint exposes each of them, because its total is added up by hand before the program touches it. Once this works, the next step up in this domain is Build a Delivery Desk for a Pizzeria.