Skip to content

Build a Box Office for a Village Hall Show

Davor Minchorov•Beginner•1 to 2 weekends•October 29, 2026

A village hall theatre group takes bookings in a shared spreadsheet and once sold 97 seats for a 90 seat show. You will build the small box office that counts seats, refuses a booking that does not fit, and checks each ticket once at the door, in the language and shape you choose.

The brief

The client

I run a community theatre group in a village hall that seats 90. We put on three performances of one play each season, and I take the bookings myself. Everyone books by email or phone, and I type them into a shared spreadsheet, then add up a column by hand to know how many seats are left.

For our last Saturday show I added wrong and sold 97 seats. I rang seven families the day before to tell them there was no room for them. On the night, a man showed us a printed ticket that his neighbour had already used, and we had no way to tell which of them was the real one. I want something small that two volunteers and I can run from one laptop.

The problem

The group tracks bookings in a spreadsheet and works out the seats left by adding a column by hand, so one slip sells seats that do not exist. A ticket is a name on a row, so a copied or forwarded ticket cannot be told from the original at the door.

Each oversold family costs the group an apology call and a regular who may not come back. The hall has 90 seats per show, so every wrong sale shows up on the night as a person with nowhere to sit.

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

  • Add a performance with a title, a start time, a number of seats and a ticket price.
  • List the upcoming performances with the start shown in the hall's local time and the number of seats left for each.
  • Take a booking for a name, an email and a number of tickets (1 to 6) against one performance, and give back a booking reference, the total price and one unique ticket code per ticket.
  • Refuse a booking that asks for more tickets than there are seats left, and refuse one for a performance that has already started. A refused booking saves nothing.
  • Cancel a booking so that its tickets stop being valid and its seats count as free again.
  • Look up a ticket by its code at the door, admit it once, and refuse a second use of the same code with a message that says when it was first used.
  • Produce a door list for one performance: who booked, how many tickets each, and how many of those have been admitted so far.
  • Keep performances, bookings and admissions when the program is closed and started again.
  • Let the person or the request supply the current time, so that closing and edge cases can be tested without waiting for the real clock.
  • Give every refusal as a message a volunteer could read aloud to the person standing in front of them.

Deliverables

  • A program in the language and shape of your choice (a web page, an API that other programs call by sending requests, or a command-line tool) that keeps performances, bookings and tickets between runs.
  • A document of the booking rules in plain sentences, written before the program.
  • A set of automated tests, code that drives the program and checks its answers against figures you expect, that runs with one command, with the command written in the README.
  • A README that takes a reviewer from a fresh copy of your project to the full evening output in 10 minutes. It also says how to supply the current time and how to make a booking stop partway for testing.
  • The output of a scripted evening on a 10 seat performance, saved in the README next to the numbers worked out by hand.

Out of scope

  • Taking payment. The client collects money by bank transfer and cash today, so a booking shows what is owed and nothing records whether it was paid.
  • Two people booking the last seats at the same moment. This box office has one person typing at a time. Simultaneous buyers belong to the next project up, Build a Ticket Shop for a Small Music Venue.
  • Holding seats while someone decides. A booking is made or it is not.
  • Several groups, halls or organisers. One group and one hall keep the data small.
  • Numbered seats and seat maps. Seats here are a count, which is all the client needs.
  • Logins and accounts, for volunteers or for people who book. Anyone who can reach the tool can use every part of it, including cancelling a booking they only know the reference of, so do not put it on the internet.
  • Sending email. Show the ticket codes on screen or in the output. Email delivery is its own job.
  • Selling, transferring or reselling tickets between people, and refunds. Money handling stays out of this project.
  • Searching the door list by name for a guest who lost their code. The client will print the list instead.

Architectural constraints

  • Seats left always equals the seats of the performance minus the tickets of bookings that are still active, after every booking, cancellation and admission.
  • A booking and all of its tickets exist together or not at all, even if the program stops in the middle of making them.
  • Amounts are exact to the cent: a price of 12.50 is 1250 cents, and a total is never off by a fraction.
  • A start of 19:30 means 19:30 in the hall's time zone (Europe/Amsterdam) wherever the program runs, and booking closes at that moment.
  • Ticket codes are unique, at least 8 characters long, and cannot be guessed from other codes.
  • Anything that depends on the current time uses the time the person or the request supplies when there is one, and the real clock otherwise. The option exists for testing.

Prerequisites

You can write a small program in a language of your choice and you have saved data to a database or a file once. You do not need to know a web framework, how automated tests work, or anything about queues or events. You do not need to know how a village hall theatre group sells its seats; the first Phase explains the business and the words the brief uses. The walkthroughs explain what goes wrong for the client and leave the way to build it to you.

Create a free accountSign in

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

Phase 1

Know the show

Produces a written list of the booking rules and a small program that keeps performances and lists the upcoming ones with their seats left. No bookings are taken yet.

Research

Implementation

Architectural walkthrough

How a village hall theatre group sells its seats

A community theatre group puts on one play a season in a village hall that seats 90, three performances of it. The organiser takes the bookings. Families, friends and regulars ask by email or phone for a number of tickets to one night, and each booking is a name, an email and a count. Seats are not numbered. The group collects the money itself, by bank transfer and cash.

On the night, two volunteers and the organiser work the door from one laptop. Guests arrive with a printed ticket, and a volunteer has to decide on the spot whether that ticket has a right to a seat. Booking for a night stops when its show starts, and 19:30 means 19:30 in the hall's own time zone.

The words this brief uses:

  • Performance: one showing of the play, with a start time, a number of seats and a ticket price.

  • Booking: one request for 1 to 6 tickets to one performance, made under a name and an email.

  • Booking reference: the reference a booking is given when it is made.

  • Ticket code: the code printed on one ticket. It is what the door checks.

  • Seats left: the seats of a performance that no active booking holds.

  • Admit: let a ticket holder in at the door. A ticket can be admitted once.

  • Door list: the printed list of who booked for one performance and how many have come in.

Why the rules come first

The client's failures came from rules nobody had said aloud. Does a cancelled booking give its seats back? Can a booking be made at the minute the show starts? What does the door do with a copied ticket? Each unanswered question is a place where the program will do something sensible that the client never wanted, and the volunteers find out on the night.

A performance also has to mean the same thing wherever the program runs. A start of 19:30 with no place attached is a different moment on a server in another country, and booking would close at the wrong hour for the hall. Prices carry the same trap: a total that is one cent off is a bug the client sees on the first bank transfer.

The listing shows seats left from the start, so a wrong count shows as soon as the first booking arrives in the next Phase. The check here is that an empty hall reads 90.

Phase 2

Take bookings

Produces bookings that give one ticket code per ticket, a refusal for a booking that does not fit, cancellation that gives seats back, and a test set that pins the edge cases. Leaves the door for the next Phase.

Implementation

Implementation

Implementation

Testing

Architectural walkthrough

A booking is made while a family waits on the phone. If the program stops partway, the family holds a booking for three seats and two codes, and the volunteers find out at the door. If it saves first and checks afterwards, a booking that never fit exists and someone has to remember to undo it. A request for 4 seats with 3 left gets a no and a count that is still 3, and no explanation about the 3 tickets that were nearly saved.

Cancelling carries its own trap: a second cancellation of the same booking must not give its seats back again.

The Phase ends with tests because the rules break quietly at the edges: exactly full, one over, zero, and the minute the show starts. A test that cannot fail protects nothing, so you break the capacity check on purpose and watch a test fail.

Phase 3

Open the doors

Produces a door check that admits each ticket once, a door list for one performance, and a scripted evening that proves the whole box office against numbers worked out beforehand. Leaves email, payment and logins out.

Implementation

Implementation

Testing

Architectural walkthrough

The failure here is the client's printed ticket that two people carried to the door, where the volunteers could not tell the owner from the neighbour.

The door list is what volunteers trust when a queue forms. A total that has not caught up with an admission or a cancellation sends them back to counting heads, which is the spreadsheet again.

The Phase ends with a full evening on a 10 seat performance. Each part can pass its own tests while two parts disagree on a number, for example when a cancellation frees a seat that the door list still counts.

Architectural walkthrough

The client's two bad moments

Seven families were told the day before a show that there was no room for them, because a column added up by hand said fewer seats were sold than the 97 that were. On the night, two people held the same printed ticket and the volunteers could not say which of them had a right to the seat. Each costs the group an apology and a regular who may not come back. The box office has to make both impossible, and rare is not enough.

A seat count that is wrong by one

A count that is off by one sells a seat that does not exist, and nothing says so until a person with a ticket has nowhere to sit. The count goes wrong at the moments nobody watches: a cancellation, a booking that fails partway, a fix typed in by hand during a rush. The client's spreadsheet worked until the first slip, and a program that lets its seat count and its bookings disagree is the same spreadsheet with a screen.

A booking that is half there

A booking that does not fit must leave nothing behind. With 3 seats left and a family asking for 4, the answer the client can explain on the phone is a no and a count that is still 3. A program that stops partway through a booking leaves a family with a booking for three seats and two codes, and they find out at the door.

Tickets at the door

A ticket code that follows a pattern can be guessed by anyone holding code 41. A code accepted twice puts two people on one seat. The volunteer needs the time of the first admission to tell the neighbour from the owner, and a second attempt that replaces that time destroys the only evidence there is.

Time and money

A start of 19:30 is a different moment in each country. If booking closes at the wrong hour because the program runs on a computer in another zone, families are turned away early or let in after the curtain. A total that is one cent off is something the client notices on the first bank transfer. The current time also has to be settable from outside, because the minute the show starts cannot be tested by waiting for it. Once this box office works, the next problem up is two buyers going for the last seat at the same moment, which is the subject of Build a Ticket Shop for a Small Music Venue.

Where it shows if you cut a corner

Four symptoms show a cut corner. A seats-left figure that differs from the seats of the show minus the tickets of active bookings after a cancellation means the count is kept apart from the bookings. A refused booking that changes the count, or a stopped booking that leaves a family with fewer codes than tickets, means a booking is saved in pieces. A code admitted twice, or a second attempt that replaces the time of the first, means the door keeps no record of the one fact the volunteer needs. Booking that closes early or stays open after the curtain on a computer set to another time zone means the start was read on the wrong clock.