All case studies
QR Table Ordering Web App · Proof of concept

Vivere Bay Cafe

QR table ordering for a cafe where guests pay on the way out. Each table orders in rounds onto one shared bill that staff follow on a live board, and the owner runs the menu and membership plans from an admin console.

Web
Vivere Bay Cafe's guest web app on two phones, the landing page and the menu, beside the line Order at the table. Pay when you leave.
Role
Spec, web app, database
Platform
Web, phone and tablet
Type
Client proof of concept
Status
Proof of concept · 2026
Overview

Vivere Bay Cafe wanted guests to order from their table and pay on the way out, the way they would with a waiter. The owner asked us for a working proof of concept of the web app. Guests open it from the QR code on their table and order in rounds onto one bill for the table. Staff follow those rounds on a live board, on their phones and on a tablet at the pass, and the owner looks after the menu from an admin console.

Once the ordering side worked, the owner asked for something that isn't food. They wanted to sell a yearly cup, engraved with the guest's name and kept at the cafe. More ideas like it were likely to follow, so instead of a one-off cup product we built a small membership system, and the cup became its first plan.

This is a proof of concept and it hasn't been through a real service yet. The guest side is deployed and opens in any browser, which is where every screen on this page comes from. The staff board and the admin console need a sign-in, so they aren't shown here. Some of the rules below will probably change once real tables use it.

The rules a pay-when-you-leave system has to settle are written up on the blog, along with how the engraved cup turned into membership plans and how Postgres enforces the whole thing.

The problem

What we set out to solve

A lot of QR ordering takes payment before the kitchen sees anything. Each order is a small closed transaction and nobody shares it. That wasn't what this cafe wanted. A table orders coffee, then a sandwich twenty minutes later, then something for the friend who turned up late, and expects one bill at the end.

So the thing being built is a shared bill that can stay open for an hour or more, with several phones adding to it. Two of them might tap Request bill at once. Two servers might confirm the same payment, and a guest on weak signal might tap Place order twice. Each of those needed a written answer before any code did.

Every cafe also gets the occasional table that leaves without paying, or a round ordered by mistake. If the only way to close a tab is to record a payment, staff will record a fake cash payment to free the table, and the day's cash total stops matching the drawer.

Our approach

How we built it

We wrote the rules down before building, one line per situation, and then put them where none of the apps could skip them. Most took a line to agree on. A few took longer, like when the bill locks and who confirms a payment.

01

The table owns the bill

Guests don't have accounts. Whoever scanned a table's code is a guest at that table. A table has at most one open tab and every order is a round on it, labelled like "Phone 2" so staff and the table can tell rounds apart. Split bills are on the parked list.

02

The bill locks when someone asks for it

Request bill freezes the tab, so the total a guest sees is the total the server collects. An order placed after that is refused with a message to ask the server, and the cart stays on the phone. When a server confirms, the amount on their button has to match the current bill.

03

Staff confirm every payment

The guest picks cash, card or online payment at checkout, and online payment shows a link with the exact amount filled in. In every case a server confirms the money arrived before the tab closes. A payment gateway was left for a later stage, and when it arrives it will confirm the same tab the same way a server does.

04

Every write is a Postgres function

Row-level security lets guests read their own table's tab and lets staff read everything. Nobody can insert or update tabs, rounds or payments from the browser. About a dozen security definer functions check who's calling, apply the rule and write, inside the transaction that makes the change.

05

Realtime as a doorbell

A Supabase Realtime event only tells a screen to reload what it's showing, after a 150ms debounce, so a round with five items causes one reload. Screens also reload when the channel reconnects and when they become visible again.

06

A membership plan is a menu item

When the cup request came in, a plan became a menu item with a validity period and perks filled in. It sells from the same menu, goes on the same bill and gets paid at the counter, so the cart, staff confirmation and the dashboard barely needed to know memberships existed.

Capabilities

What it does

Rounds on one tab

Friends who scan the same table's code join one tab. Each phone's orders show as its own round, and the bill is every round added up.

A private code per table

Each table's QR carries its own code, and guests never see another table's. The generic menu link only offers tables with nothing going on, so a busy table is joined by scanning its code.

A bill that locks

Once someone taps Request bill, the tab stops taking orders. If two phones tap it, the first counts and the second sees "Bill already requested".

Staff-confirmed payments

Cash, card and online payments all close the tab only when a server confirms them. If the bill changed in between, the confirm fails and asks them to check the new total first.

A live board with a chime

New rounds and bill requests reach staff phones and the tablet at the pass with a two-note chime and a vibration where the device supports it. Two taps on the same ticket move it one step.

Mistakes and walk-outs

A round ordered by mistake can be cancelled, and the bill drops. A table that left without paying is closed as unpaid, which frees it with no payment attached.

Membership plans

Any menu item can be marked as a plan in the admin console, with a validity period, a discount on the bill, free items, and a line saying what the cafe has to prepare. The engraved yearly cup was the first.

A phone number as the card

Memberships belong to a phone number. The phone that bought a plan attaches it to the next order on its own, and anyone else can type the number. Free items are marked by a server, so a member can save one for another visit.

Prices fixed when ordered

Rounds keep the price they were placed at, and memberships keep the terms they were bought under. The owner can change a price during lunch without touching rounds already placed.

Under the hood

Architecture

It's one Next.js 16 App Router app, with route groups for the guest, staff and admin apps. Supabase provides Postgres, auth and Realtime. The ordering rules live in Postgres functions, so every app goes through the same ones.

Guest app

Opens from a table's QR code. Opening a table link signs the phone in as a Supabase anonymous user, so every guest has a user id and nobody creates an account. The phone sends item ids and quantities, never a price, plus a key that makes a repeated order safe.

Next.js 16Supabase anonymous authIdempotency keys
Staff board

Staff sign in with their name and a PIN, which also unlocks the browser's audio for the new-order chime. Rounds arrive as tickets that move forward one step at a time. A server confirms each payment from a button that shows the amount being accepted.

Supabase RealtimeWeb Audio API
Admin console

The owner signs in with email to edit the menu and prices and to set up membership plans. A members page lists who bought which plan, when it runs out, and whether the cup has been handed over yet.

Next.js 16Supabase Auth
Postgres rules

Reads go through row-level security, and writes go through functions such as place_round, request_bill and confirm_payment. A partial unique index allows one open tab per table. Tax is worked out in one function that every total comes from, and column grants keep phone numbers out of guest reads.

PostgreSQLPL/pgSQLRow-level securityColumn grants
Tech stack

Built with

App
Next.js 16
App Router, route groups for guest, staff and admin
Web Audio API
New-order chime with no audio file
Table QR codes
One private code per table
Supabase
PostgreSQL
Rules in security definer functions
Row-level security
Guests read only their own table
Supabase Auth
Anonymous sessions for guests
Supabase Realtime
Tells each screen when to reload
Testing
Unit tests
56: money, phone numbers, cart, components
Database tests
40 against a real Supabase Postgres
Playwright
39 tests, guest phone and staff tablet
Hard parts

Engineering challenges

Challenge

Two phones place the first order for an empty table at the same moment.

Solution

A partial unique index allows only one open tab per table, but on its own it would hand the second guest a constraint error. So place_round first takes a transaction-level advisory lock on the table. The two orders queue up, the first opens the tab, and the second finds it and becomes round 2.

Challenge

A guest on weak signal taps Place order, sees nothing happen, and taps again.

Solution

The phone makes a UUID when the order sheet opens, and place_round checks it against a unique column before doing anything else. The second tap gets back the round that already exists, so the kitchen sees one round. Opening the sheet again makes a fresh key, so a second order placed on purpose still goes through.

Challenge

Two servers confirm the same bill, or tap the same ticket, at the same time.

Solution

confirm_payment locks the tab row with select for update, checks the tab can still be paid and that the amount matches the current total, and only then records the payment. The second confirm waits for the lock, finds the tab closed and is told the bill is already closed. advance_round takes the status the server's screen was showing and refuses if the round has moved on, so a double tap can't skip a ticket from New to Ready.

Challenge

Supabase Realtime doesn't replay events to a device that was asleep or offline when they happened.

Solution

Events only trigger a reload. Each screen also reloads when its channel subscribes, which includes every reconnect, and when it becomes visible again, so a tablet that slept for ten minutes catches up the moment it wakes. A Playwright test takes the staff browser offline, places an order from a guest phone, reconnects, and expects the ticket to appear.

Challenge

Guests can read their own tab, and the tab holds the phone number and name given at checkout.

Solution

Column-level grants let clients select every column of the tabs table except the phone number and guest name, and staff read the number through a function that checks they're staff. We checked on the hosted project that Realtime applies the same column privileges to what it sends, and the publication lists only the safe columns of the members table in case that ever changes.

Screens

A look inside

Outcome

What shipped

A deployed proof of concept. Anyone can open the guest side in a browser, and the staff board and admin console sit behind sign-in.
Every change to a tab, a round or a payment goes through a Postgres function, so all three apps share one set of rules.
135 tests in three layers. The database tests call the functions as a guest, a second guest at the same table, staff and the admin, and the Playwright tests drive a guest phone and a staff tablet from the first order to a paid bill.
A small membership system the owner can add plans to from the admin console, with the engraved yearly cup as the first one.
Mistaken rounds and walk-outs have their own actions, so freeing a table never needs a made-up payment.
Not yet through a real service. Split bills, item options, a payment gateway and day close with cash reconciliation are parked for later, and we're waiting to see which rules staff end up working around.

Want us to build something like this?

Tell us about your project. Notchip scopes, designs, and ships on a milestone basis — you only pay for results.

Start a project
Next case study
Clipping Marketplace