Skip to content

Build a Delivery Desk for a Pizzeria

Davor Minchorov•Intermediate•8 to 10 weekends•November 19, 2026

A pizzeria with its own drivers charges cards at checkout, prints tickets in the kitchen and hands out deliveries in a WhatsApp group, and on a busy Friday those three never agree on what happened to an order. You will build the ordering system where the card hold, the kitchen and the driver always agree, and prove it on a simulated Friday evening with failures injected.

The brief

The client

I own a pizzeria in a town of about 40,000 people. Customers order on our website, a plugin charges the card at checkout, a cloud printer in the kitchen prints the ticket, and on Friday evenings seven drivers take the pizzas out.

One Friday at 19:40 we ran out of dough. The kitchen phoned 11 customers whose cards the plugin had already charged, and I refunded each of them by hand on Monday by editing the order total, which left three of them with a different amount than the others. The drivers get orders in a WhatsApp group where the first one to reply "mine" takes it, and that same night two drivers drove off with the same order.

I need an ordering system where the card hold, the kitchen and the driver always agree on what happened to an order, and where at closing I can show where every cent went, tips included.

The problem

The plugin captures the card at checkout and keeps one status text per order. The plugin, the printer app and the drivers' WhatsApp replies all effectively overwrite it, so nothing can answer whether the money, the kitchen and the driver agree.

The website sells and charges whether or not the kitchen can make the pizza, because taking payment never waits for the kitchen to say yes. The same happens when the printer loses its connection, so the shop also has to stop selling while the kitchen cannot be reached. Every refund is a manual edit of an order total, so a pizza removed before capture and a pizza removed after capture end with different amounts, and the owner cannot say which is right.

Tips are inside the card total, so they sit in the day's takings and reach the drivers in cash when somebody remembers. Under the provider's terms the shop loses the card fee on a refunded capture, and the Monday refunds cost it the fees on 11 captures and the goodwill of 11 customers. A closing report that matches neither the till nor the card provider's list of captures takes an evening to reconcile by hand.

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

  • Let the owner publish a menu with modifiers, allergen tags and opening hours, and mark items sold out.
  • Let a customer build a basket and see a total with delivery fee and tip that equals the amount held on the card.
  • Place an order so that a repeated or simultaneous submit creates one order and one card hold.
  • Hold the card before the kitchen is asked, and charge only for the lines that were delivered plus the delivery fee and tip.
  • Show each order on the kitchen tablet, take an acceptance with a prep time or a rejection within 5 minutes, and release the hold on rejection, no answer or cancellation.
  • Stop taking orders while the kitchen tablet has been silent for 3 minutes, and resume when it returns.
  • Let drivers claim an order from a board, give it to exactly one, take it back when the driver hands it in or never shows, and tell the owner when nobody claims it.
  • Show the customer the order's status on a page that stays correct after any restart or crash, and give the owner the history of every order and a list of problems that need a person.
  • Show the owner a day report with every delivered order as lines, tips in their own account, that matches the card provider's list of charges.
  • Erase a customer's name, phone and address on request while the day report and the delivery proofs stay intact.

Deliverables

  • Your repository starts the shop and the three stand-ins (a card provider, a kitchen tablet and a driver phone) with one command.
  • A README that takes a reviewer from a fresh clone to one order placed, held, accepted, delivered, charged and visible in the day report in 15 minutes, and lists the command for each test.
  • The replay of the Friday from the first Phase: the parties, the steps, what is left behind when a step fails and every limit with its number, kept in your repository and corrected when the build shows it wrong.
  • A tablet integration guide: how a kitchen tablet asks the shop for tickets and answers them, enough for another developer to build a real tablet app.
  • A test suite that includes race tests with real simultaneous requests and crash tests that kill the running shop, and the committed results of the simulated Friday with every injected failure listed.
  • A way to run the shop's day faster than real time and to cause each outside failure the brief names: a clock you control, the stand-ins and the Friday runner.
  • A short owner's note: what the owner can do (stop and reopen orders, clear entries on the problem list, ask for an erasure), what each kind of entry on the list means and what to do about it.

Out of scope

  • A marketplace of many restaurants, commission and restaurant payouts. The client is one pizzeria, and the three-sided money belongs to "Build a Food Delivery Platform".
  • Tax. Menu prices are the final prices the customer pays. Rates and rules vary by place and need a source, and the problem under study does not depend on them.
  • Bank challenge (3-D Secure). It needs a customer redirect and a deadline of its own, and the hold rules can be learned without it.
  • Refunds after capture, "not received" claims and bank disputes. The shop settles these in the provider's dashboard.
  • Checking that the provider's messages are genuine. A real provider signs them; here the stand-in runs on your own machine and the failure under study is the repeat, not the forgery.
  • Real maps, geocoding and routing. A delivery area is a list of 25 postcodes the shop serves.
  • Customer and driver mobile apps. A web page and the stand-ins play those roles.
  • A real payment provider or real card data. A stand-in keeps the build on one machine and card data out of your repository.
  • Automatic offers to drivers one at a time. A board where the first claim wins teaches the same race with less to build.
  • Batching, one driver carrying two orders. It turns assignment into a matching problem.
  • Collection orders where the customer picks up. They skip the driver step, and delivery keeps one fixed path.
  • Driver wages, rotas and payroll. The shop records the tips owed to a driver, and paying a wage is the shop's business.
  • Promotions, loyalty, ratings and reviews. Each adds pricing or moderation rules outside the problem under study.
  • Push, SMS and email notifications. The status page is how the customer learns an order changed.
  • Customer accounts and login. Guest checkout with a phone number is enough, and the tool is not meant to sit on the internet.
  • Cloud deployment and Kubernetes. Everything runs on one machine.
  • Payment methods other than cards, such as iDEAL. The shop takes cards only, because the card is held before the kitchen says yes and charged after delivery, and iDEAL takes the money at once.

Architectural constraints

  • Amounts are exact to the cent, in euros, and the total shown to a customer equals the amount held on their card.
  • A customer's card is never charged for an order the kitchen has not accepted, and never for more than the delivered lines plus the delivery fee and the tip.
  • A customer can cancel only until the kitchen accepts. After acceptance the cancel is refused.
  • One order never holds or charges a card twice, however often the same request or message arrives and however the shop is restarted.
  • An order keeps the prices it was placed at when the menu changes later.
  • No card number is ever stored or logged by the shop. Only the provider's payment tokens are.
  • A wrong clock on the kitchen tablet or on a driver's phone moves no limit. The shop's own time decides every limit.
  • A restart or crash at any moment leaves no order waiting forever and no card hold open for an order that has ended, except a hold that is on the owner's list of problems.
  • Tips and food sales are separate in the day report and never netted against each other.
  • A line in the day report is never edited or deleted.
  • Name, phone and delivery address are erased on request. Report lines and delivery proofs stay, identified by order reference, for 7 years. The Dutch tax administration (Belastingdienst) requires the shop to keep its business records for 7 years, and that duty is the owner's.
  • The shop never deactivates a driver on its own. It raises an entry on the owner's list.
  • Opening hours and the dates of the day report use Europe/Amsterdam.

Prerequisites

You have built one application with a database, in any language and framework. You need no distributed systems experience and no payments experience, and no other Codyssey project. You do not need to know how a pizzeria takes and delivers its orders; the first Phase explains the business and the words the brief uses. You build the stand-ins yourself. The race tests in this brief send real simultaneous requests, so your shop has to handle several requests at the same moment: a setup that handles one request at a time hides the bugs these tests exist to catch. Having once debugged two records that disagreed about the same fact will make most of this brief feel familiar.

Create a free accountSign in

Free to start. An account is what keeps track of the checkpoints you finish.

Phase 1

Work out the rules and start the shop

Produces a worked sheet of what happens to one order, with the client's numbers, and a shop that starts with one command and runs on a clock you control. Leaves all ordering behaviour for later, so there is no menu, no order and no payment yet.

Research

Implementation

Architectural walkthrough

How a pizzeria takes delivery orders

The client owns a pizzeria in a town of about 40,000 people. A customer orders on the website, picks from a menu with extras such as cheese or a choice of size, adds a tip if they want to, and pays by card. The shop delivers to a list of 25 postcodes and charges a delivery fee of 300 cents. The kitchen sees each order on a tablet, and a printer prints the ticket. On Friday evenings seven drivers take the pizzas out.

The card is held when the order is placed, which sets the money aside without taking it. The kitchen then says yes or no. A yes comes with a prep time, and a no or no answer within 5 minutes releases the hold. The customer is charged after delivery, for the delivered lines plus the delivery fee and the tip. If the kitchen cannot make an item, it drops that line from the order. The tip belongs to the driver. The card provider takes a fee on each charge.

At closing the owner wants a day report that shows where every cent went and matches the card provider's list of charges. The shop keeps its report lines and delivery proofs for 7 years, because Dutch law requires it to keep business records that long.

The words this brief uses:

  • Hold: money set aside on a customer's card at order time without being taken. A hold expires after a window, 7 days by default.

  • Charge: taking the held money, after delivery.

  • Release: letting a hold go without charging.

  • Modifier: an extra or a choice on a menu item, such as extra cheese.

  • Prep time: how long the kitchen says an order will take.

  • Board: the list of orders ready for a driver, from which a driver claims one.

  • Delivery proof: the record that an order arrived, with the driver and the times.

  • Day report: the owner's closing report of every delivered order, line by line.

  • Card fee: what the card provider takes from the shop on each charge.

Why the gaps between steps come first

This Phase has no ordering behaviour. It exists because the client's Friday went wrong in the gaps between steps, and nobody had written down what should happen in them.

An order touches a card provider, a kitchen tablet and a driver's phone, and none of the three can be rolled back together with the others. When a step fails late, something is left behind, and each wait in the order's life needs a number.

The second problem is time. The failures that cost the client money show up at 19:40 on a Friday, with seven drivers out and the kitchen behind.

Phase 2

Take an order

Produces the menu, the quote and a placed order that is placed once, with every refusal the shop owes a customer. Leaves the card, the kitchen and the driver for later, so a placed order waits for payment and nothing picks it up yet.

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

This Phase covers what can go wrong before any card is touched: a price that changes under an order, a total that drifts by a cent, the same order sent twice, and an order the shop should never have taken. The client already lives with the first: the Monday refunds were made by editing order totals, which left three of the 11 customers with a different amount than the others.

Phase 3

Hold the card

Produces a card provider stand-in you build yourself and the hold on the card for every placed order, kept correct when the provider is slow, down, repeating itself or reordering its messages, or when the shop dies mid-hold. Leaves the kitchen for later, so a held order waits and nothing is charged.

Implementation

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

This Phase turns on one rule: the card is held first and charged last. A hold reserves an amount on the customer's card and takes nothing. A charge later takes the money, for the held amount or less. The plugin the client runs charges at checkout, and that is how 11 customers paid for dough that did not exist. Holding first means a rejection, a timeout or an outage costs the customer nothing, and releasing the hold is the whole refund.

The provider is an outside party that does not behave: it can make the hold and lose the answer, repeat its messages and send them out of order, and the shop itself can die mid-hold. You build the provider yourself, to fail on command.

Phase 4

Ask the kitchen

Produces the kitchen tablet stand-in you build and the order's life up to the kitchen's answer: tickets, acceptance, rejection, cancellation, the 5-minute limit and a shop that stops selling while the tablet is silent. Leaves drivers and charging for later, so an accepted order waits and nothing is charged.

Implementation

Implementation

Implementation

Testing

Testing

Architectural walkthrough

This Phase turns on one question: what happens to the customer's reserved money while the shop waits for a kitchen that may never answer.

Every way out of the wait leaves a hold on a card. The kitchen rejects the order, nobody answers within 5 minutes, or the customer cancels. If one of those exits forgets to release the hold, the customer sees a reservation for food that was never cooked, which is exactly what the 11 customers on that Friday saw.

The tablet is an outside party you cannot trust: it asks for tickets itself, can answer twice or late, and can carry a clock that is an hour off. The shop also has to notice when nobody is reading tickets, remember what was waiting across a restart, and settle a cook's accept and a customer's cancel that arrive together.

Phase 5

Give each order a driver

Produces the driver board, the driver phone stand-in you build, and an order that goes to exactly one driver, is taken back when a driver hands it in or never shows, and is flagged when nobody wants it. Leaves charging for the next Phase, so a delivered order is still only delivered.

Implementation

Implementation

Testing

Architectural walkthrough

This Phase is about the Friday when two drivers drove off with the same order. The group chat let both answer "mine" in the same second and each believed they had won. The cost was one wasted trip, a second pizza that nobody was waiting for, and a customer who got two knocks on the door or none.

An order a driver claims and never collects, an order nobody claims and a board that opens at the wrong moment each leave a pizza on the counter. The shop notices and tells the owner, and it never decides anything about a driver.

Phase 6

Get paid and show where every cent went

Produces the charge for what was delivered, a charge that happens once whatever goes wrong, a warning to the owner when a charge fails, and a day report that matches the card provider's list of charges. Leaves the full evening for the next Phase, so each part is proven on a handful of orders.

Research

Implementation

Testing

Implementation

Implementation

Testing

Architectural walkthrough

This Phase is about the money, and the client has lived the cost of getting it wrong. The plugin charged the whole total at checkout, so every rejection became a manual refund. Under the provider's terms the shop loses its card fee on a refunded charge, and the Monday refunds cost the fees on 11 charges and the goodwill of 11 customers.

The hold was for the whole order. The charge is for what arrived: the delivered lines, the delivery fee and the tip. If the kitchen removed a 900 line from a 3,100 order, the customer pays 2,200 and the books show 2,200 to the cent.

A second charge, a refused charge nobody hears about, and a tip folded into food sales are the failures that follow.

Phase 7

Run a Friday

Produces a runner that plays a simulated Friday evening against the whole shop, a way to erase a customer's personal fields while the books stay intact, and a proof that the evening survives every failure at once. Adds no new order behaviour, so everything it finds is a gap in the earlier Phases.

Implementation

Implementation

Testing

Architectural walkthrough

This Phase is judged from outside, on a repeatable evening. The first run has no failures and serves as the baseline: 30 orders over 2 simulated hours with 7 drivers on shift. The failing run injects six failures, each aimed at a promise made earlier: a silent tablet, a provider that errors, messages that arrive twice or late, two drivers on one order, two drivers who drop their orders, and a shop that is killed and restarted. A pass means the promises hold, not that the evening was quiet.

The Phase also erases a customer's personal fields while the books stay intact. The report lines and the delivery proofs are kept for 7 years, because the Dutch tax administration requires the owner to keep business records that long.

Architectural walkthrough

Three records, three stories

The old setup keeps one status text per order and lets the plugin, the printer app and the drivers' WhatsApp replies all overwrite it. When the money, the kitchen and the driver disagree, nothing can say which one is right. On the Friday in the brief, 11 customers were charged for food nobody cooked and two drivers left with the same order. The client paid for it twice: once in Monday refunds that left three customers with a different amount than the rest, and once in card fees, because under the provider's terms a refunded charge keeps its fee.

Steps you cannot take back together

An order touches a card provider, a kitchen tablet and a driver's phone, and none of the three can be rolled back along with the others. When a step fails late, something is left behind: a hold on a card for a pizza that will not come, a ticket on the tablet for an order the customer cancelled, a driver on the way to collect something that does not exist. The customer sees it first, as a reservation on their card statement or a pizza that never arrives, and the pizzeria sees it as a phone call.

Two people, one last thing

Two drivers answer "mine" in the same second. A cook presses accept while the customer presses cancel. A browser sends the same order twice in the same instant. Each of these works when the requests arrive one after the other and breaks when they arrive together. The cost is a wasted trip, a pizza cooked for an order nobody can charge for, or two holds on a card for one pizza. Tests that send the requests one at a time pass for a shop that fails on Friday.

Messages that arrive late, twice or out of order

The card provider reports what it did, and it promises to report at least once, in no guaranteed order. A "charged" message can arrive before the answer to the charge. An "expired" message can arrive after the money was already taken. The same message can arrive twice. A shop that believes whatever came last completes an order twice, releases money that was taken, or moves an order backwards, and the first person to notice is the customer.

The shop dies in the middle

A shop can be killed between saving an order and telling the kitchen, or between the provider charging and the shop writing it down. Nothing shows an error. The customer has paid for food nobody is cooking, or has been charged twice, and nobody finds out until they phone. A restart that forgets what was waiting leaves orders waiting forever with the customer's money reserved behind them.

What to check in your build

If your build passes every test and still fails one of these, look at what the test exercised. A request sent after the previous one finished is not a race. A shop that was never switched off is not a restart test. A clock that was never moved cannot show a limit passing. A failure that never took effect in the Friday run proves nothing, so read the results for evidence that each one did.

Next step

"Build a Food Delivery Platform" takes the same hold, kitchen and courier order further: more parties, refunds on both sides of the charge, three-sided money and a simulated dinner peak. You will recognise the failures from this build.

Where it shows if you cut a corner

Four symptoms show a cut corner. Customers are charged for food nobody cooked, as 11 were on the Friday in the brief, or a card shows a hold for an order that has ended. Two drivers leave with the same order. A customer has two holds on the card for one pizza after a repeated submit or a repeated provider message. An order waits for ever with the customer's money reserved behind it after a restart.