Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/apursley2012/alex-pizza-assistant/llms.txt

Use this file to discover all available pages before exploring further.

The Pizza Ordering Chatbot is a static browser application built as a direct translation of a Python console ordering program. The original project used terminal prompts to walk a user through a pizza order and calculate the final cost. The browser version keeps that same step-by-step conversational structure, expands it to support multi-pizza orders, and presents the logic through a chat-style interface that works on GitHub Pages with no backend required.
This case study was written by the project author, Alysha Pursley, as part of the original project documentation. It covers the key design decisions, logic structure, and areas identified for future improvement.

Project Overview

The app introduces a virtual assistant named Alex who guides the customer through a complete pizza order. Alex collects all required details one question at a time, validates every response before advancing, calculates the order total using fixed pricing values, and displays a live receipt panel that updates throughout the conversation. The entire app runs in the browser using plain HTML, CSS, and vanilla JavaScript — no frameworks, no build tools, no server. The project was designed to demonstrate beginner programming concepts in a context that feels more interactive than a terminal window, while remaining simple enough to read and understand as a learning example.

What the Chatbot Collects

Alex gathers the following information during an order session:
1

Customer name

The first thing Alex asks for. Used to personalize responses throughout the session.
2

Pizza size

Small, medium, or large. Determines the unit price for that pizza.
3

Toppings

Free-text entry. Multiple toppings can be separated by spaces. Entering cheese is the expected input for a plain pizza.
4

Crust type

Free-text entry. Examples include thin, thick, pan, or deep dish.
5

Quantity

A whole number greater than zero. Multiplied against the unit price to get the item total.
6

Carry out or delivery

Determines whether a delivery fee applies and affects the cash payment message. Collected once after the pizza loop.
7

Add another pizza?

A yes/no prompt after each pizza is confirmed. If yes, the pizza questions repeat and the new pizza is added to the order.
8

Payment method

Cash or card. Determines which checkout branch runs.
9

Card details (card orders only)

Card number, expiration date in MM/YY format, and a 3 or 4 digit security code. All three are validated before showing the simulated approval.
10

Driver tip (delivery + card orders only)

An optional dollar amount added to the total. The prompt includes the note that 100% of tips go to the driver.

Input Validation Strategy

The original Python version used while loops to keep asking for a value until the user entered something the program could use. The browser version applies the same idea through client-side validation: each step has a validate function, and if the response does not pass, an error message is shown inline and the app does not advance. Every validated field, its rule, and the error shown on failure:
FieldValidation RuleError Message
NameCannot be blankName cannot be blank.
Pizza sizeMust be small, medium, or largePlease enter small, medium, or large.
ToppingsCannot be blankToppings cannot be blank. If you do not want any toppings, simply enter cheese.
Crust typeCannot be blankCrust type cannot be blank.
QuantityWhole number greater than zeroPlease enter a numeric value greater than 0.
Add anotheryes, y, no, or nPlease enter yes or no.
Order methodcarry out, carryout, pickup, or deliveryPlease enter carry out or delivery.
Payment methodcash, card, credit, or debitPlease enter cash or card.
Card number13–19 digits (spaces and dashes stripped)Please enter a card number using 13 to 19 digits.
Expiration dateMM/YY formatPlease enter the expiration date as MM/YY.
Security code3 or 4 digitsPlease enter a 3 or 4 digit security code.
Tip amountValid dollar amount such as 3, 3.50, or 0Please enter a valid tip amount, like 3, 3.50, or 0.
Input normalization runs after validation passes. Variants like carryout, pick up, and pickup are all mapped to carry out. credit, debit, credit card, and debit card are all mapped to card. y and yes are both treated as yes.

Order Flow Logic

The central logic change from the original Python version is the multi-pizza loop. Rather than ending after one pizza, the app keeps collecting pizzas until the customer says no to the addAnother prompt. The flow for each pizza is:
  1. Collect size, toppings, crust type, and quantity
  2. Push the completed pizza object into the order.pizzas array
  3. Ask whether the customer wants to add another pizza
  4. If yes — reset the temporary pizza fields and return to step 1
  5. If no — advance to the order method question
The order method (carry out or delivery) is asked once, after the pizza loop ends. Every pizza in the order falls under the same method. This keeps the checkout branching clean — the delivery fee, cash messages, and tip prompt all depend on a single order.method value.

Payment Logic

After the order method is confirmed, Alex asks for a payment method. The checkout flow branches from that point: Cash — delivery Alex tells the customer that the driver will collect payment upon delivery. The checkout is complete after this message. Cash — carry out Alex tells the customer to pay when picking up the order. The checkout is complete after this message. Card — any order type Alex collects three fields in sequence:
  1. Card number (13–19 digits)
  2. Expiration date (MM/YY)
  3. Security code (3 or 4 digits)
Once all three pass validation, Alex displays a simulated approval message referencing the last four digits of the card number. The full card number is never stored — only the last four digits are saved to the order object.
The card checkout is a front-end demo only. No payment data is transmitted, processed, or stored anywhere. The simulated card flow is included to demonstrate conditional input branching and multi-step form logic, not to handle real transactions.

Pricing Logic

All pricing is calculated from fixed values defined in the app. The full formula is:
total = subtotal + tax + deliveryFee + tip
subtotal = sum(price[size] × quantity for each pizza)
The values used:
ItemValue
Small pizza$8.99
Medium pizza$14.99
Large pizza$17.99
Delivery fee$5.00
Sales tax10% (applied to pizza subtotal only)
Coupon threshold$50.00
Tax is computed as subtotal × 0.1. The delivery fee is only added when order.method is "delivery". The tip is only collected for delivery orders paid by card, and is added directly to the total. After the final total is calculated, the app checks whether it meets the coupon threshold. Orders at or above 50.00receiveamessageawardinga50.00 receive a message awarding a 10 off coupon for the next order. Orders below that amount are shown a message noting that the coupon is available for orders over $50.

Static App Design

The interface is split into two main areas that update together as the conversation progresses:
  • Chat feed — Alex’s prompts and the customer’s replies appear as styled message bubbles. The conversation builds up in the feed so the full context of the order session is always visible.
  • Receipt panel — a live sidebar that updates after each confirmed answer. It shows the customer name, order method, payment method, and a running breakdown of subtotal, tax, delivery fee, tip, and total. Each completed pizza is listed as a separate line item with its own size, toppings, crust, unit price, and item total.
The receipt panel makes the multi-pizza logic immediately visible. The customer can see their full order building up before they reach checkout, which makes the itemized structure easier to understand than a terminal print statement. The app is entirely static. It works on GitHub Pages without a backend, a database, a build step, or a real payment processor. All state is held in a plain JavaScript object for the duration of the browser session.

Future Improvements

Several improvements were identified after completing the current version:
  • Menu buttons for common toppings — instead of a free-text field, the toppings step could offer clickable options for the most common choices, reducing blank or unusable entries.
  • Order review screen — a confirmation step before checkout that shows the full pizza list and lets the customer make changes before entering payment details.
  • Clearer total breakdown — the receipt panel currently shows subtotal, tax, delivery fee, tip, and total as separate lines, but a dedicated summary section that labels the calculation steps more explicitly would make the pricing logic easier to follow.
  • Single shared data source — pricing values are currently defined in app.js and mirrored in data/menu.json. Moving to a single source of truth would mean price updates only need to be made in one place, reducing the risk of the two files falling out of sync.

Build docs developers (and LLMs) love