The problem
META Gaming Pub, in Bagheria near Palermo, is a cellar, pub and games room. Since 2025 its tables have ordered from a menu that opens with a QR code, built with M’s Works, and the kitchen works from it: by August 2026 it had taken 2,003 orders.
The venue wanted a loyalty card on the phone. One point per euro, five per hour of play, six levels, badges to collect and to buy, and a yearly membership.
To award points on orders, the loyalty platform had to know what each table orders. In August Antonio decided to rebuild the menu inside the platform: from then on the platform also carries the kitchen’s orders, and has to hold up through every evening’s service.
What made it hard
A points card is simple until the points are worth something.
A menu that can’t stop. The kitchen works from the menu in use. Touching it to connect the loyalty platform meant changing live tables during service.
Ordering only from the venue. An order has to come from a table in the venue. And the venue has no fixed internet address to recognise.
Points that are worth discounts. If a staff member can credit points to themselves, or get an order cancelled and keep the points, the card becomes a hole in the till.
Leaderboards the phone mustn’t decide. In the app’s arcade, a score sent by the phone can be faked in a minute.
One table, several phones. People at the same table need to see what the others pick, without sending the same dish twice.
The choices
For every problem there was a more obvious route. Here is what we did instead, and why.
The new menu next to the old one
Connect the loyalty platform to the menu in use, changing it while the venue works.
The menu is rebuilt inside the loyalty platform, on a separate schema of the same database. The one in use isn’t touched, and is switched off in one go on a day the venue is closed.
Why. Throughout development the risk to the kitchen’s menu is zero, and the new one can be tried on real data, in parallel.
The technical detail
The two schemas (public for the menu in use, fidelity for the new one) live side by side in the same Postgres. The configuration migrates, about 450 rows of catalogue, tables, stations and settings. At the switch the old application has to be shut down completely: left on, it would keep writing and the two systems would drift apart silently.
The venue’s network, plus a secret
Accept orders only from the venue’s internet address.
The QR codes point to a device on the venue’s network, unreachable from outside. It acts as a Reverse proxyA device that receives requests on behalf of the server and passes them on, adding or checking something. and adds a secret: without it, the server rejects the order.
Why. The venue’s address changes on its own, and a check on it can be bypassed. The private address says where you are, and the printed QR codes already pointed there.
The technical detail
The secret is compared in constant time, on the first line of every action that writes. With no secret configured, orders are rejected: that way a forgotten variable shuts the door instead of opening it. Tested on 11 August 2026: the same order replayed without the header is rejected and creates no order; with the header it goes through and gives 8 points.
Nobody gives themselves points
A “credit points” permission for floor staff, with a log of who used it.
No operator, not even the administrator, can give themselves points, hours of play or badges. Cancelling an order takes back the points it gave, in the same operation.
Why. An exception with a reason gets bypassed by writing a reason. Asking a colleague costs little, and it stays on record with both names.
The technical detail
The refusal sits in the service and doesn’t look at the role. Hours of play are capped at 6 per person per evening, loaded once. The reversal of a cancellation is a single movement per card (<order>:cancel, unique in the database), and never takes the balance below zero.
The server works out the score
The phone sends the score at the end of the game, and the server saves it.
Every game opens on the server with a random seed. The phone records only the inputs, and at the end the server replays the game and keeps the score it gets.
Why. A score sent by the phone can be typed in by hand. A Replayed gameThe phone sends only the inputs given during the game, and the server plays it again from the start to know the real score. gives the real result, or nothing.
The technical detail
The engine steps at a fixed rate (1/60 s) and is deterministic. The server accepts only if the game ends on the last frame, isn’t faster than the time since it opened, hasn’t expired and uses the same rules version. Capped at 40 games an hour; rejected ones are kept with the reason. Game points aren’t loyalty points and are worth nothing at the till.
How it works
The customer app, the staff panel and the menu. The app and panel screenshots come from a local copy, with made-up customers and points.


The card, offline too
In the customer app the card with its code opens even without a connection. It installs from the browser, as an Installable web appA website you add to your phone’s home screen and open like an app, without going through the stores..
Shared order at the table
Phones at the same table see what the others pick. The same dish added by someone else in the last 30 seconds gets flagged, and two sends make a single order.
Order board
A public page for the screens in the room: order code and status, with no table, names or amounts.
The database defends itself
The app uses a role with only the permissions it needs, Row Level SecurityA check inside the database that decides who can read and write the rows of a table. is on for every table and the balance can’t go below zero.
What changed
loyalty tables with Row Level Security on, and the app connected through a role that can’t see the rest of the database.
In practice: if the database password ever leaked, it wouldn’t open the menu in use or the games library.
Checked on the database on 3 October 2026, after a dry run in a transaction (the project’s D-055).orders created by the same order replayed from outside the venue, without the device’s secret.
Test of 11 August 2026: the request captured from the browser and replayed was rejected (the project’s D-048).- Live at three addresses: the customer app, the staff panel and the menu.
- The menu in use was never touched during development.
- The switch from the menu in use happens on a day the venue is closed, with the old one shut down.
Fact sheet
- Client
- META Gaming Pub
- Sector
- Gaming pub and restaurant, Bagheria (Palermo)
- What it is
- Installable loyalty app, staff panel and menu with table ordering
- Year
- 2026
- Live at
- fidelity.metagamingpub.itadmin.metagamingpub.itmenu.metagamingpub.it
- Status
- Live; customers start using it after the switch from the menu in service
- Built with
- Next.jsTypeScriptPrismaPostgreSQLSupabaseBetter AuthStripeBun
- Who did it
- Antonio Murabito with M’s Works, before Certalea
If you have a similar job
Three questions to ask yourself before talking to anyone about it, us included.
- Can the system you’re about to replace stay on while you build the new one?Two systems side by side on the same database cost less than an evening with the kitchen stopped.
- In your business software, who can give themselves points, discounts or credit?If the answer is “whoever has the permission”, the permission alone isn’t enough.
- If the points are worth something, who works them out?Whatever the phone works out can be faked. The sums belong where the customer can’t reach.
We reply within 24 hours. The first call is free.





