Skip to content

Build a Till and Stockroom for a Tapas Bar

Davor Minchorov•Intermediate•7 to 8 weekends•November 5, 2026

A 38-seat tapas bar took fifteen orders for eleven portions of grilled octopus when its terrace wifi dropped and its till, two handhelds and a delivery app each sold from the number they last saw. You will build the replacement, from publishing a menu and firing a round to selling the last portion of a plate exactly once across every seller and closing the business day. You prove it in a simulated Friday where a handheld loses wifi, a card reader times out and the delivery app repeats itself.

The brief

The client

I own a 38-seat tapas bar. Guests order small plates a round at a time, from the till at the bar, from two waiters' handhelds on the terrace and through one delivery app. Last Saturday I had eleven portions of grilled octopus when the terrace wifi dropped for forty minutes, and the till, both handhelds and the app each sold from the number they last saw, so we took fifteen orders for it and four tables had to choose again. A guest on a split check was charged twice when the card reader timed out, which I only learned when she emailed me. We close after 01:00, so Saturday's late takings landed on Sunday's sheet, and my pen count on Monday showed we had been short on squid all week. I need the last portion sold once, a card charged once, and a Monday count that tells me what we really used.

The problem

Orders come from four sellers that each keep their own idea of how many portions of a limited plate are left. Two sellers that see 1 left at the same moment both sell it, and a handheld that loses wifi sells from a stale number until it reconnects, so the oversell is found after the tables have been told yes.

Ingredient stock is a different problem. It is counted by hand once a week, so food cost is a guess and a plate runs out mid-service with nobody warned. The day also has two meanings: the owner closes at 04:00 and reads takings per night, while the bookkeeper's sheet uses the calendar date, so an order rung at 01:30 on Sunday sits on the wrong row. A manager approves voids at the till and nothing records who. The bad Saturday cost four re-ordered tables, one double-charged guest and a day of reading three screens to find which order was a duplicate.

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 plates with a price, a recipe in grams and, for a limited plate, a portion count for the day, and keep every earlier version of a price and recipe readable.
  • Let a waiter place an order in rounds, fire a round, and show each station (kitchen and bar) only its own plates, with bump and recall.
  • Void or comp a line as a new record that names the approver. Nothing is edited or deleted.
  • Sell a limited plate no more times than there are portions, across the till, both handhelds and the delivery app at once, and show the plate as sold out on every connected seller within 10 seconds of its last portion being sold or the chef taking it off. A handheld with no connection learns when it reconnects.
  • Let a handheld that lost wifi keep taking orders from the portions it was given, and merge its orders when it reconnects without losing or duplicating one.
  • Split a check across cards and cash, charge each card part exactly once even when the provider answers late, and settle the check only when its parts add up to its total.
  • Accept an order from the delivery app once, even when its message arrives twice, and reject it when the plate is gone or the app's 3-minute accept window has passed.
  • Take each fired round's ingredients out of stock once, record deliveries, counts and waste with the person who decided, and list the ingredients whose counted usage differs most from what the recipes predict.
  • Close the business day at the site's cutoff and produce the Z report (the end-of-day sales summary) that the owner checks against the bookkeeper's sheet, with each fact assigned to a day by the cutoff and not the calendar date.
  • Erase a delivery guest's name and phone on request and keep the orders and payments, identified by ID.

Deliverables

  • Your repository starts the whole product with one command, plus stand-ins for a waiter's handheld, the delivery app and the card provider that can cause the failures this brief names.
  • A README that takes a reviewer from a fresh clone to a closed simulated Friday with its Z report in 20 minutes, and lists the command for each test.
  • Documentation for the people and devices that talk to the product: how a handheld uploads orders, how the delivery app's messages are received, how the card provider's notices are received, and how staff publish a plate, place an order, take a payment, record a count and read a report.
  • A test suite that includes the simultaneous-seller race, plus the results of the simulated Friday from the final Phase committed to your repository.
  • A way to run the bar's Friday faster than real time with a fixed seed, so two runs on a fresh install give the same totals.
  • An operations note, stated as outcomes: how an operator finds and finishes an order or a stock change that a crash left half done, how to compare a closed day's report with the figures recomputed from its orders, and how to read the consistency check.

Out of scope

  • Several sites, a central menu and stock transfers. This is one bar. Multi-site data is the subject of Build a Restaurant Group Back-Office, the next step up.
  • Table booking, a waitlist and no-show fees. The bar takes walk-ins, and a booking is a different scarce thing with one holder and no offline seller. Build a Table Book for a Small Bistro covers booking at a smaller size, and the next step up covers it with a waitlist.
  • Rosters, rest rules, clocking and tip pooling. The owner cooks and runs five staff, so the report shows food cost only and prime cost is out.
  • Purchase orders, supplier invoices, three-way matching, lot recalls and fridge logs. A delivery is one stock entry here, and matching three documents belongs to the next step up.
  • Allergen derivation from recipes. A line may carry a free-text note for the kitchen, and working out a plate's allergens from its ingredients is catalogue work for the next step up.
  • Adding a tip after capture, refunds with a named approver and the card processor's tip window. A tip is recorded when a part is captured, and deadlines set by a processor belong to the next step up.
  • Card payments taken offline and offline limits per terminal. The handheld orders offline and does not take card money. Offline liability is a payments question that the next step up owns.
  • Platform settlement reconciliation and commission. Money from the delivery app is paid to the bar outside this system, so only the order is in scope.
  • Tax lines, the VAT split, fiscalisation and real card processing. Prices and totals are gross amounts in euro cents, and the card provider is a stand-in you write. The bookkeeper also needs turnover per VAT rate, which the Z report does not show, so it is a summary the owner checks and not a filing.
  • Stock of drinks. Drinks are plates with an empty recipe, because counting bottles is a different problem from counting grams.
  • A front end, a booking site and a staff app. Requests you document and the simulator scripts stand in for them, because every check is on behaviour.
  • Logins and identity checks. Staff are named by a staff id and a staff role that each staff request carries, and the product trusts and records them. Do not put this product on the internet.
  • A correction for a handheld's wrong clock. The time a handheld says an order was taken is trusted as sent.
  • Kubernetes or cloud deployment. Everything runs on one machine.

Architectural constraints

  • Amounts are exact to the cent. Prices and totals are whole euro cents and weights are whole grams.
  • A limited plate is never sold more times than there are portions, across every seller, including while a handheld has no connection.
  • A card is never charged twice for one payment, however many times the provider answers, repeats itself or arrives out of order. No card number is ever stored or logged, only a token and the last four digits.
  • A message from an outside party that arrives twice changes nothing the second time, and an older message never overwrites newer news.
  • A crash between saving something and the effect that should follow it loses nothing and doubles nothing.
  • Every fact belongs to a business day set by the bar's zone, Europe/Amsterdam, and its 04:00 cutoff, never by the calendar date. What happened first stands, whichever message arrives first.
  • Nothing is edited or deleted. A void, a comp, a count and a waste entry are added records that name the person who decided.
  • An issued Z report never changes. A fact that arrives after its day closed appears as a correction that names the difference.
  • A delivery guest's name and phone are erased on request once the order's business day is closed, and the orders, payments and stock records stay, identified by ID. No log, file or store the product keeps holds them afterwards. The bar must keep its business records for 7 years under Dutch rules (Belastingdienst), which is why they stay; a guest's name and phone are not part of what that rule requires.

Prerequisites

You have built one application with a database, in any language and framework. You have run it, tested it and fixed a bug you found by running it. You do not need distributed systems experience, and you do not need restaurant knowledge, because the first Phase explains how a tapas bar sells, serves and counts its plates and the words the brief uses, and each Checkpoint explains the problem it checks. You will run several things at once on one machine: the product, two handheld stand-ins, a delivery-app stand-in and a card-provider stand-in. Having once watched two people overwrite each other's change in an application you built will make Phase 3 familiar. The beginner project Build a Table Book for a Small Bistro covers the same domain at a smaller size and is not required.

Create a free accountSign in

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

Phase 1

Publish the menu and fix the business day

Produces the bar's menu, with every earlier price and recipe kept, and the rule that puts each sale on its business night. Takes no orders yet, and limited plates have no portion count in play until Phase 3.

Research

Implementation

Implementation

Architectural walkthrough

How a tapas bar sells, serves and counts its plates

The client owns a 38-seat tapas bar. Guests order small plates a round at a time. Orders come from four sellers: the till at the bar, two waiters' handhelds on the terrace and one delivery app. The owner also sells some plates in a limited number each day, such as grilled octopus, so a plate can run out in the middle of service.

A waiter places a round and fires it, which sends the plates to the station that makes them. The kitchen and the bar each see only their own plates. A station marks a ticket done by bumping it, and can bring it back with a recall. A guest pays at the end, often with the check split across several cards and cash. A manager approves a void, which removes a line, or a comp, which gives a line away. The bar closes after 01:00 and the owner counts a night as ending at 04:00, so a 01:30 order on a Sunday belongs to Saturday's night.

Behind the plates is the stockroom. Every plate has a recipe in grams. Deliveries arrive, the owner counts the stock by hand, and some food is wasted. Comparing what the recipes say was used with what the counts show tells the owner where food goes. At close the till produces an end-of-day sales summary that the owner checks against the bookkeeper's sheet. The delivery app sends each order as a message that must be accepted within 3 minutes.

The words this brief uses:

  • Plate: one dish on the menu, with a price and a recipe in grams.

  • Limited plate: a plate with a set number of portions for the day.

  • Round: the plates a table orders together.

  • Fire: send a round to the stations to be made.

  • Station: the kitchen or the bar, each of which sees only its own plates.

  • Bump and recall: a station marking a ticket done, and bringing it back.

  • Void and comp: removing a line and giving a line away, each approved by a manager.

  • Split check: a check paid in parts by several cards and cash.

  • Business day: the bar's night, ending at 04:00, which can differ from the calendar date.

  • Z report: the end-of-day sales summary.

Why prices and the business day come first

The bar's records go wrong in two quiet ways, and this Phase prevents both before any order exists. The first is last week's takings changing when the owner edits a price. The second is Sunday's 01:30 order landing on Sunday's sheet, when it was Saturday's night.

A price is a fact about a moment. If the menu keeps only today's price, a report for last Tuesday uses Wednesday's price, and the usage report compares last week's sales with this week's recipes. The owner cannot tell a good week from a repriced one, and the bookkeeper's sheet no longer matches what the till printed. A recipe changes the same way: a plate that moved from 180 g to 150 g of octopus makes last month look as if the kitchen wasted it.

The day is a rule applied to a moment, and the rule has to hold on the two nights a year when the clocks change. On the night the clocks go forward, the hour between 02:00 and 03:00 does not exist. On the night they go back, 02:30 happens twice. A cutoff written as a fixed offset from UTC is right for half the year and an hour out for the other half, and the bar finds out when the bookkeeper's sheet disagrees with the owner's.

Work the cases by hand first. Every later Phase leans on the answers, and a rule that has only ever agreed with its own code proves nothing.

Phase 2

Take orders and fire rounds

Produces orders placed in rounds with every line sold at the price in force then, kitchen and bar tickets with bump and recall, and voids and comps that name an approver. A limited plate has no portion limit yet, and nothing can be paid until Phase 4.

Implementation

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

The failures here are small and each costs the kitchen or the bill. A past order changes price when the menu does. A request sent twice makes two orders, or fires a round twice, and the kitchen cooks the same plates twice. A void erases who made it and what the line looked like before, so nobody can answer a guest or the owner.

Tapas arrive in rounds. A table asks for a few plates, then a few more, and each round is sent to the kitchen and the bar on its own clock. A line is a fact about one sale, so it keeps the price and recipe it was sold at, whatever the owner publishes later. A waiter on a handheld whose wifi hiccups sends the same order again, and the bar must end up with one order and one set of tickets, because a second set means a second dish nobody ordered.

A correction is a statement that someone decided something. If the line is edited in place, the owner loses the name of the person and the bill as it stood. A void after the kitchen cooked is a different fact from a void before it, because the food is spent, and a waiter should not be able to make it alone.

Limited plates have no portion limit in this Phase, so ordering twelve octopus portions six times succeeds. Phase 3 changes that.

Phase 3

Sell the last portion once

Produces limited plates that sell exactly as many portions as exist across the till, two handhelds and the chef's 86, including a handheld that loses wifi. The delivery app is not a seller yet, so its two octopus portions stay unsold, and nothing is paid for.

Implementation

Implementation

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

This Phase is the client's bad Saturday. Eleven portions of grilled octopus, four sellers, and fifteen orders. Each seller believed its own number, so every table was told yes until the kitchen ran out.

Two sellers that ask at the same moment are the first problem. Both see 1 portion left, both say yes, and one guest is told later that the plate is gone, usually after the table has ordered the rest of the meal around it. A handheld with no wifi is the second problem. It cannot ask anyone, so it cannot find out that the other sellers sold the portions it thinks it has, and it cannot stop selling either, because the terrace is full.

The bar's answer to the second problem is a rule about shares. The owner divides a limited plate's portions among the sellers, each seller sells only from its own share, and a share lasts 30 minutes. A seller that reports back returns what it did not sell. One that never reports leaves those portions counted as sold, because the product cannot know whether they were sold, and the bar would rather lose a portion than tell a second table yes to a plate that is gone.

Two facts reach a seller late: a plate sells out on another seller, and the chef calls an 86 (taking a plate off sale until she restores it) that an offline handheld cannot hear. Connected sellers must learn within 10 seconds. The handheld learns when it reconnects, and its orders from the offline stretch are then judged by when they were taken, so a table that ordered before the 86 keeps its plate and a table that ordered after loses it, whichever upload arrives first.

The last Checkpoint replays the Saturday. A test that runs one request at a time proves nothing here, because the failure only exists while two requests are in flight together.

Phase 4

Take payments and delivery orders

Produces split-check payments against a card-provider stand-in you write, delivery-app orders against a second stand-in, and tests that replay every outside message. Tips after capture, refunds, card payments taken offline and settlement with the delivery app are left out.

Implementation

Implementation

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

Two outside parties talk to the product, and both misbehave in ways real ones do. The failures are the client's double charge on a split check, and a delivery order that is accepted twice or sells a plate that is gone.

A card provider can charge a card and then fail to answer in time. The product cannot tell a charge that happened from one that did not, and both guesses cost money: charge again and the guest pays twice, give up and the bar may serve a meal it was never paid for. The provider can also send its news twice, send it late, or send "declined" for a payment it already reported as captured. A delivery app can send the same order twice, send it after its 3-minute accept window, or send it for a plate that has just sold out.

You write a stand-in for each party, because you cannot make the real ones misbehave on demand, and a failure you cannot trigger is a failure you have not tested. Each stand-in must be able to cause every behaviour named above, and the tests must run the product against them.

Last, a crash between taking the final payment and closing the order leaves a table that has paid and a check that stays open. Phase 5 reads everything this Phase produces. A payment counted twice or an order accepted twice shows up as a wrong total in the Z report, and it is cheaper to prove here that neither can happen than to find it on the bookkeeper's sheet.

Phase 5

Count the stock, close the day and prove it

Produces ingredient stock, the variance report, the day close with its Z report, erasure of a delivery guest, and a simulated Friday checked by a consistency check. Purchase orders, supplier invoices, prime cost and several sites are left for the next step up.

Implementation

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

The failures here are a Monday count nobody can explain, a Z report that changes after the owner checked it against the bookkeeper's sheet, and a guest's name that cannot be removed because it was copied into places nobody remembers.

Ingredient stock is a different kind of number from a limited portion. A portion is a promise and has to be right at the moment of sale. Stock follows what happened and is corrected by counts. A fired round takes ingredients out, a delivery adds some, and a count says what the shelf really holds. Between counts the balance may be wrong, even negative, and that tells the owner something: more went out than came in on paper, so a delivery is missing or portions are bigger than the recipe. If a fired round is counted twice, or not at all, every Monday count looks short or long for a reason nobody can find.

A Z report is the end-of-day sales summary. Once the day closes and the owner has checked it against the bookkeeper's sheet, a fact that arrives later, such as a handheld that uploads at 05:00, cannot change it. It has to appear as a visible difference that names what changed, or the owner can never again trust a filed figure.

A delivery guest's name and phone are personal data. The bar must erase them on request while the order, the payment and the stock records stay, identified by ID. If those values were copied into a log, a saved message or a note about a failure, the erasure leaves traces that nobody finds.

The final Checkpoint plays a whole Friday with every failure from the earlier Phases happening on the same night, then runs the consistency check. Failures that are harmless alone, such as a late card answer during a handheld merge, are what fills a Friday with surprises.

Architectural walkthrough

Four sellers, one number

The client's bad Saturday had eleven portions of grilled octopus and fifteen orders. The till, both handhelds and the delivery app each held their own copy of the number and subtracted from their own copy. Nothing could say how many portions existed, because four places each believed a different answer. Four tables had to choose again, and each of them had already been told yes.

An offline handheld makes it harder. It cannot ask anyone, yet it must not stop selling for forty minutes, and it must not sell what the other sellers have already sold. A sold-out plate also has to reach the other sellers fast. The bar promises 10 seconds, because every extra table told yes to a gone plate is a re-order and a bill adjustment. Check your build with fifteen orders arriving at once and read the count.

A charge that may or may not have happened

A card reader that times out does not say whether the card was charged. If the till charges again to be safe, the guest pays twice, which is how last Saturday's guest found out, by email. If it does not charge again, the bar may serve a meal it is never paid for. The same doubt applies to every outside message. The delivery app may send an order twice. The provider may send "declined" after it sent "captured". Check what each repeated, late or out-of-order message does to the totals.

Stock that is allowed to be wrong

The last portion of a plate is a promise to a guest and has to be right at the moment of sale. Ingredient stock is a running estimate that nobody checks until the weekly count, so it drifts, and a plate runs out mid-service with nobody warned. The count is where the owner sees the drift, and the pen count that showed a week of short squid shows what the owner loses without it: she cannot tell portions that grew from a delivery nobody entered.

The night is not the calendar date

The owner closes at 04:00 and reads takings per night. An order rung at 01:30 on Sunday belongs to Saturday's night, and twice a year the clocks change in the middle of that stretch. An owner who checks a Z report against the bookkeeper's sheet and sees it change afterwards stops trusting every other figure, so a late fact has to show up as a visible difference and never as a quiet edit.

A crash between two steps

A process can die after a payment is saved and before the order closes. It can die after a round is fired and before the stock reflects it, or after a delivery-app message was accepted and before the order exists. The first leaves a table that has paid and a check that stays open. The second leaves Monday's count short for ingredients the stock never recorded as used. The third leaves the app believing an order was accepted that the kitchen never received. Kill the product at each of these points and look at what the owner would see.

Where it shows if you cut a corner

If sellers keep their own copy of the count, the fifteen simultaneous orders in Phase 3 sell more than eleven portions. If a retry is treated as a new payment, the split check in Phase 4 charges a card twice. If the sum of what was paid is not checked against the total, a short check closes. If the Z report is computed from the calendar date, the simulated Friday puts the 01:30 takings on the wrong night, and the consistency check reports a closed day that differs from its issued report.